Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface CurvePath<T>

An abstract base class extending Curve. A CurvePath is simply an array of connected curves, but retains the api of a curve.

Type parameters

Hierarchy

Index

Constructors

constructor

Properties

arcLengthDivisions

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. Default is 200.

default

200

autoClose

autoClose: boolean

Whether or not to automatically close the path.

default

false

curves

curves: I3JS.Curve<T>[]

The array of Curves.

default

[]

type

type: string
default

'CurvePath'

Methods

add

clone

closePath

  • closePath(): void

computeFrenetFrames

copy

fromJSON

getCurveLengths

  • getCurveLengths(): number[]

getLength

  • getLength(): number

getLengths

  • getLengths(divisions?: number): number[]

getPoint

  • getPoint(t: number, optionalTarget?: T): T
  • Parameters

    • t: number
    • Optional optionalTarget: T

    Returns T

    Returns an array of points representing a sequence of curves. 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 LineCurve, the returned number of points is always just 2.

getPointAt

  • getPointAt(u: number, optionalTarget?: T): T
  • Parameters

    • u: number

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

    • Optional optionalTarget: T

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

    Returns T

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

getPoints

  • getPoints(divisions?: number): T[]

getSpacedPoints

  • getSpacedPoints(divisions?: number): T[]

getTangent

  • getTangent(t: number, optionalTarget?: T): T
  • Parameters

    • t: number

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

    • Optional optionalTarget: T

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

    Returns T

    Returns a unit vector tangent at t. 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.

getTangentAt

  • getTangentAt(u: number, optionalTarget?: T): T
  • Parameters

    • u: number

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

    • Optional optionalTarget: T

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

    Returns T

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

getUtoTmapping

  • getUtoTmapping(u: number, distance: number): number
  • Given u in the range ( 0 .. 1 ), returns t also in the range ( 0 .. 1 ). u and t can then be used to give you points which are equidistant from the ends of the curve, using .getPoint.

    Parameters

    • u: number
    • distance: number

    Returns number

toJSON

  • toJSON(): object

updateArcLengths

  • updateArcLengths(): void

Generated using TypeDoc