Curved Path - a curve path is simply a array of connected curves, but retains the api of a curve.

A CurvePath is simply an array of connected curves, but retains the api of a curve.

Type Parameters

Hierarchy (view full)

Constructors

Properties

arcLengthDivisions: number

This value 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.

200

Expects a Integer

autoClose: boolean

Whether or not to automatically close the path.

false
curves: Curve<TVector>[]

The array of Curves.

[]

type: string

A Read-only string to check if this object type.

Sub-classes will update this value.

CurvePath

Methods

  • Add a curve to the .curves array.

    Parameters

    Returns void

  • Creates a clone of this instance.

    Returns this

  • Adds a lineCurve to close the path.

    Returns this

  • Generates the Frenet Frames

    Parameters

    • segments: number

      Expects a Integer

    • Optionalclosed: boolean

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

    Requires a Curve definition in 3D space Used in geometries like THREE.TubeGeometry | TubeGeometry or THREE.ExtrudeGeometry | ExtrudeGeometry.

  • Copies another Curve object to this instance.

    Parameters

    Returns this

  • Copies the data from the given JSON object to this instance.

    Parameters

    Returns this

  • Get list of cumulative curve lengths of the curves in the .curves array.

    Returns number[]

  • Get total Curve arc length.

    Returns number

  • Get list of cumulative segment lengths.

    Parameters

    • Optionaldivisions: number

      Expects a Integer

    Returns number[]

  • Returns a vector for a given position on the curve.

    Parameters

    • t: number

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

    • OptionaloptionalTarget: TVector

      If specified, the result will be copied into this Vector, otherwise a new Vector will be created. Default new T.

    Returns TVector

  • Returns a vector for a given position on the Curve according to the arc length.

    Parameters

    • u: number

      A position on the Curve according to the arc length. Must be in the range [ 0, 1 ]. Expects a Float

    • OptionaloptionalTarget: TVector

      If specified, the result will be copied into this Vector, otherwise a new Vector will be created. Default new T.

    Returns TVector

  • Returns an array of points representing a sequence of curves

    Parameters

    • Optionaldivisions: number

      Number of pieces to divide the curve into. Expects a Integer. Default 12

    Returns TVector[]

    The division parameter defines the number of pieces each curve is divided into However, for optimization and quality purposes, the actual sampling resolution for each curve depends on its type For example, for a THREE.LineCurve | LineCurve, the returned number of points is always just 2.

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

    Parameters

    • Optionaldivisions: number

      Number of pieces to divide the curve into. Expects a Integer. Default 40

    Returns TVector[]

  • Returns a unit vector tangent at t

    Parameters

    • t: number

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

    • OptionaloptionalTarget: TVector

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

    Returns TVector

    If the derived Curve does not implement its tangent derivation, two points a small delta apart will be used to find its gradient which seems to give a reasonable approximation.

  • Returns tangent at a point which is equidistant to the ends of the Curve from the point given in .getTangent.

    Parameters

    • u: number

      A position on the Curve according to the arc length. Must be in the range [ 0, 1 ]. Expects a Float

    • OptionaloptionalTarget: TVector

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

    Returns TVector

  • Given u in the range [ 0, 1 ],

    Parameters

    • u: number

      Expects a Float

    • distance: number

      Expects a Float

    Returns number

    t also in the range [ 0, 1 ]. Expects a Float.

    u and t can then be used to give you points which are equidistant from the ends of the curve, using .getPoint.

  • Returns a JSON object representation of this instance.

    Returns CurvePathJSON

  • Update the cumulative segment distance cache

    Returns void

    The method must be called every time Curve parameters are changed If an updated Curve is part of a composed Curve like THREE.CurvePath | CurvePath, .updateArcLengths() must be called on the composed curve, too.