Inheritance: Curve →
A curve representing a Catmull-Rom spline.
//Create a closed wavey loop
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.getPoints( 50 );
const geometry = new THREE.BufferGeometry().setFromPoints( points );
const material = new THREE.LineBasicMaterial( { color: 0xff0000 } );
// Create the final object to add to the scene
const curveObject = new THREE.Line( geometry, material );
Constructs a new Catmull-Rom curve.
points
An array of 3D points defining the curve.
closed
Whether the curve is closed or not.
Default is false.
curveType
The curve type.
Default is 'centripetal'.
tension
Tension of the curve.
Default is 0.5.
Whether the curve is closed or not.
Default is false.
The curve type.
Default is 'centripetal'.
This flag can be used for type testing.
Default is true.
An array of 3D points defining the curve.
Tension of the curve.
Default is 0.5.
Returns a point on the curve.
t
A interpolation factor representing a position on the curve. Must be in the range [0,1].
optionalTarget
The optional target vector the result is written to.
Overrides: Curve#getPoint
Returns: The position on the curve.