The Curve.getSpacedPoints()
method returns an array of points that are spaced evenly along the curve. The number of points returned is determined by the divisions
parameter, which specifies the distance between each point.
getSpacedPoints(divisions)
divisions
— A number that specifies the number of points to be returned.An array of points that are spaced evenly along the curve.
const curve = new THREE.CatmullRomCurve3( [
new THREE.Vector3( -10, 0, 10 ),
new THREE.Vector3( -5, 5, 5 ),
new THREE.Vector3( 0, 0, 0 ),
new THREE.Vector3( 5, -5, 5 ),
new THREE.Vector3( 10, 0, 10 )
] );
const points = curve.getSpacedPoints( 50 );
In this example, a CatmullRomCurve3
is created with five control points. The getSpacedPoints()
method is called with a divisions
value of 50, so an array of 50 evenly spaced points along the curve is returned.
divisions
to obtain a smoother curve.divisions
to obtain a coarser curve or to optimize performance.Curve.getPoints()
returns an array of points that are interpolated along the curve.Curve.getLength()
returns the total length of the curve.