Hello Friends,

I have an interesting challenge that wanted to see how to solve. I have 7 vertices that define different segments of a curved line that i am connecting to different circles per screen shot below. My issue is i want each segment of this line between the two circles to have a different color. So here is the code fragment:

```
pointcurve = [ [114, 136, 52], [106, 136, 64],
[112, 80, 64], [100, 80, 70], [154, 230, 54],
[176, 212, 50], [180, 232, 64] ];
const curve = new THREE.CatmullRomCurve3(
pointcurve.map((e)=>{
return new THREE.Vector3(e[0], e[1],e[2])
})
);
curve.closed = false;
curve.tension = .1;
const vertices = [];
curve.getPoints(800).forEach((e)=>{
vertices.push(
e.x, e.y, e.z
);
});
const colors = [];
for (let x=0; x < vertices.length; x++) {
colors.push(Math.random(), Math.random(), Math.random());
}
const geometry = new THREE.BufferGeometry();
geometry.setAttribute( 'position', new THREE.Float32BufferAttribute( vertices, 3 ) );
geometry.setAttribute( 'color', new THREE.Float32BufferAttribute( colors, 3 ) );
```

When i create random colors i want each color to paint a segment of the line based on the pointcurve arrays. But when i call the following api:

let vertices = curve.getPoints(800);

The vertices now contain many many more little vertices which are neccassary to smooth each line. But if i go through the vertices array and color each element, then i end up with a single line between the two circles with multiple colors, but in reality i want that segment of the line to have the same color. And the next segment between the other circles to have a different color.

So how do i know how many of these little vertices beling to the same line so i can paint them the same color?

Here is a screen shot of the actual lines drawn in 3d:

I want each line between the circles to have a different color. But i dont want the same line between the two circles to have multiple colors. So, I need to know how to calculate the boundary of vertices for each line segment so i can pain them the same color.

Thanks