[page:Curve] →
[name]
Create a smooth 3d spline curve from a series of points using the
[link:https://en.wikipedia.org/wiki/Centripetal_Catmull-Rom_spline Catmull-Rom] algorithm.
Example
//Create a closed wavey loop
var 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 )
] );
var points = curve.getPoints( 50 );
var geometry = new THREE.BufferGeometry().setFromPoints( points );
var material = new THREE.LineBasicMaterial( { color : 0xff0000 } );
// Create the final object to add to the scene
var curveObject = new THREE.Line( geometry, material );
[example:webgl_geometry_extrude_splines geometry / extrude / splines]
Constructor
[name]( [param:Array points], [param:Boolean closed], [param:String curveType], [param:Float tension] )
points – An array of [page:Vector3] points
closed – Whether the curve is closed. Default is *false*.
curveType – Type of the curve. Default is *centripetal*.
tension – Tension of the curve. Default is *0.5*.
Properties
See the base [page:Curve] class for common properties.
[property:Boolean isCatmullRomCurve3]
Used to check whether this or derived classes are CatmullRomCurve3s. Default is *true*.
You should not change this, as it used internally for optimisation.
[property:Array points]
The array of [page:Vector3] points that define the curve. It needs at least two entries.
[property:Boolean closed]
The curve will loop back onto itself when this is true.
[property:String curveType]
Possible values are *centripetal*, *chordal* and *catmullrom*.
[property:float tension]
When [page:.type] is *catmullrom*, defines catmullrom's tension.
Methods
See the base [page:Curve] class for common methods.
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]