Curve

CatmullRomCurve3

Create a smooth 3d spline curve from a series of points using the Catmull-Rom algorithm.

Example

//Create a closed wavey loop var curve = new v3d.CatmullRomCurve3([ new v3d.Vector3(-10, 0, 10), new v3d.Vector3(-5, 5, 5), new v3d.Vector3(0, 0, 0), new v3d.Vector3(5, -5, 5), new v3d.Vector3(10, 0, 10) ]); var points = curve.getPoints(50); var geometry = new v3d.BufferGeometry().setFromPoints(points); var material = new v3d.LineBasicMaterial({ color : 0xff0000 }); // Create the final object to add to the scene var curveObject = new v3d.Line(geometry, material);

geometry / extrude / splines

Constructor

CatmullRomCurve3(points : Array, closed : Boolean, curveType : String, tension : Float)

points – An array of 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 Curve class for common properties.

.isCatmullRomCurve3 : Boolean

Used to check whether this or derived classes are CatmullRomCurve3s. Default is true.

You should not change this, as it used internally for optimisation.

.points : Array

The array of Vector3 points that define the curve. It needs at least two entries.

.closed : Boolean

The curve will loop back onto itself when this is true.

.curveType : String

Possible values are centripetal, chordal and catmullrom.

.tension : float

When .type is catmullrom, defines catmullrom's tension.

Methods

See the base Curve class for common methods.

src/extras/curves/CatmullRomCurve3.js