CatmullRomCurve3 - Verge3D User Manual - Soft8Soft
Description: Learn how to use CatmullRomCurve3 in your interactive 3D apps made with Verge3D

Curve →

# CatmullRomCurve3

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

## Code Example

`// create a closed wavey loop const 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) ], true); const points = curve.getPoints(50); const geometry = new v3d.BufferGeometry().setFromPoints(points); const material = new v3d.LineBasicMaterial({ color: 0xff0000 }); // create the final object to add to the scene const curveObject = new v3d.Line(geometry, material); app.scene.add(curveObject);`

## 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.

### # .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 .curveType is `"catmullrom"`, defines catmullrom's tension.

## Methods

See the base Curve class for common methods.

## Source

For more info on how to obtain the source code of this module see this page.