Class CubicBezierCurve3

A smooth 3d cubic bezier curve, defined by a start point, endpoint and two control points.

Example

const curve = new CubicBezierCurve3(
new Vector3( -10, 0, 0 ),
new Vector3( -5, 15, 0 ),
new Vector3( 20, 15, 0 ),
new Vector3( 10, 0, 0 )
);

const points = curve.getPoints( 50 );

Hierarchy

  • Curve<Vector3>
    • CubicBezierCurve3

Constructors

  • Create a new instance.

    Parameters

    • Optional v0: Vector3

      – The starting point.

    • Optional v1: Vector3

      – The first control point.

    • Optional v2: Vector3

      – The second control point.

    • Optional v3: Vector3

      – The ending point.

    Returns CubicBezierCurve3

Properties

arcLengthDivisions: number

Determines the amount of divisions when calculating the cumulative segment lengths of a curve via .getLengths. To ensure precision when using methods like .getSpacedPoints, it is recommended to increase .arcLengthDivisions if the curve is very large.

Default

200

isArcCurve: boolean

subclass should override

Default Value

false

isCatmullRomCurve3: boolean

subclass should override

Default Value

true

isCubicBezierCurve: boolean

subclass should override

Default Value

false

isCubicBezierCurve3: boolean

Default Value

true

isEllipseCurve: boolean

subclass should override

Default Value

false

isLineCurve: boolean

subclass should override

Default Value

false

isLineCurve3: boolean

subclass should override

Default Value

false

isQuadraticBezierCurve: boolean

subclass should override

Default Value

false

isQuadraticBezierCurve3: boolean

subclass should override

Default Value

false

isSplineCurve: boolean

subclass should override

Default Value

false

type: string

Default Value

'CubicBezierCurve3'

v0: Vector3

The starting point.

Default Value

new Vector3()

v1: Vector3

The first control point.

Default Value

new Vector3()

v2: Vector3

The second control point.

Default Value

new Vector3()

v3: Vector3

The ending point.

Default Value

new Vector3()

Methods

  • Creates a new instance with same property values as this curve.

    Returns

    A new Curve instance exactly like this curve.

    Returns Curve<Vector3>

  • Generates the Frenet frames. Learn more at http://www.cs.indiana.edu/pub/techreports/TR425.pdf

    Returns

    An object with shape: { tangents: Vector3[]; normals: Vector3[]; binormals: Vector3[]; }

    Parameters

    • segments: number

      Number of segments

    • Optional closed: boolean

      True if this curve is closed.

    Returns { binormals: Vector3[]; normals: Vector3[]; tangents: Vector3[] }

    • binormals: Vector3[]
    • normals: Vector3[]
    • tangents: Vector3[]
  • Get list of cumulative segment lengths.

    Returns

    Array of points

    Parameters

    • Optional divisions: number

    Returns number[]

  • Find the point (vector) for point t of the curve where t is between 0 and 1.

    Returns

    The point.

    Parameters

    • t: number

      A position on the curve. Must be in the range [ 0, 1 ].

    • Optional optionalTarget: Vector3

      (optional) If specified, the result will be copied into this Vector, otherwise a new Vector will be created.

    Returns Vector3

  • Find a vector for point at relative position in curve according to arc length

    Returns

    The point.

    Parameters

    • u: number

      A position on the curve according to the arc length. Must be in the range [ 0, 1 ].

    • Optional optionalTarget: Vector3

      (optional) If specified, the result will be copied into this Vector, otherwise a new Vector will be created.

    Returns Vector3

  • Compute a set of divisions + 1 points using getPoint( t ).

    Returns

    Array of point vectors.

    Parameters

    • Optional divisions: number

      number of pieces to divide the curve into. Default is 5.

    Returns Vector3[]

  • Compute a set of divisions + 1 equi-spaced points using getPointAt( u ).

    Returns

    Array of point vectors.

    Parameters

    • Optional divisions: number

      number of pieces to divide the curve into. Default is 5.

    Returns Vector3[]

  • Compute a unit vector tangent at t. If the subclassed curve do not implement its tangent derivation, 2 points a small delta apart will be used to find its gradient which seems to give a reasonable approximation getTangent(t: number, optionalTarget?: T): T;

    Returns

    A vector tangent to t.

    Parameters

    • t: number

      A position on the curve. Must be in the range [ 0, 1 ].

    • Optional optionalTarget: Vector3

      — (optional) If specified, the result will be copied into this Vector, otherwise a new Vector will be created.

    Returns Vector3

  • Compute the tangent at a point which is equidistant to the ends of the curve from the point given in getTangent().

    Returns

    a vector tangent to u.

    Parameters

    • u: number

      A position on the curve according to the arc length. Must be in the range [ 0, 1 ].

    • Optional optionalTarget: Vector3

      (optional) If specified, the result will be copied into this Vector, otherwise a new Vector will be created.

    Returns Vector3

  • Given u ( 0 .. 1 ), get a t to find p. This gives you points which are equi distance

    Parameters

    • u: number
    • distance: number

    Returns number

  • Create a JSON object representation of this instance.

    Returns

    A JSON object

    Returns object