# Create any shape and run it along a curve

Hello, Dear Community.
I understand how to draw a line from an array of points

const curvePoints = [
[-6, 0, 10],
[-1, 0, 10],
[3, 0, 4],
[6, 0, 1],
[11, 0, 2],
[13, 0, 6],
[9, 1, 9],
[4, 1, 7],
[1, 1, 1],
[0, 1, -5],
[2, 0, -9],
[8, 0,-10],
[13, 0, -5],
[14, 1, 2],
[10, 3, 7],
[2, 1, 8],
[-4, 3, 7],
[-8, 1, 1],
[-9, 1, -4],
[-6, 1, -9],
[0, 1,-10],
[7, 1, -7],
[5, 2, 0],
[0, 2, 2],
[-5, 1, 0],
[-7, 2, -5],
[-8, 2, -9],
[-11, 2, -10],
[-14, 1, -7],
[-13, 1, -2],
[-14, 0, 3],
[-11, 0, 10],
[-6, 0, 10]
];

const pts = ;

for ( let i = 0; i < curvePoints.length; i += 1 ) {

``````pts.push( new THREE.Vector3( curvePoints[ i ][0], curvePoints[ i ][1], curvePoints[ i ][2] ) );
``````

}

const ls = 1400; // length segments
const curve = new THREE.CatmullRomCurve3( pts );
const points = curve.getPoints( ls );

const line = new THREE.LineLoop( new THREE.BufferGeometry( ).setFromPoints( points ), new THREE.LineBasicMaterial( { color: 0x3366ff } ) );

I am getting this kind of result. Super

How to create any shape and run/extrude it along a curve?

I mean, how can I, for example, get a pipe of this shape at these given points?

Sorry for the stupid newbie questions.

Thanks

roller coaster example might be a good place to start

2 Likes