Curve

THREE.extras.core.Curve
abstract class Curve extends Object

An abstract base class for creating an analytic curve object that contains methods for interpolation.

Attributes

Graph
Supertypes
class Object
trait Any
class Object
trait Matchable
class Any
Known subtypes

Members list

Value members

Concrete methods

override def clone(): Curve

Returns a new curve with copied values from this instance.

Returns a new curve with copied values from this instance.

Attributes

Returns

{Curve} A clone of this instance.

Definition Classes
Object
def computeFrenetFrames(segments: Double, closed: Boolean): FrenetFrames

Generates the Frenet Frames. Requires a curve definition in 3D space. Used in geometries like [[TubeGeometry]] or [[ExtrudeGeometry]].

Generates the Frenet Frames. Requires a curve definition in 3D space. Used in geometries like [[TubeGeometry]] or [[ExtrudeGeometry]].

Value parameters

{boolean}

[closed=false] - Whether the curve is closed or not.

{number}

segments - The number of segments.

Attributes

Returns

{{tangents: Array , normals: Array , binormals: Array }} The Frenet Frames.

def copy(source: Curve): Curve

Copies the values of the given curve to this instance.

Copies the values of the given curve to this instance.

Value parameters

{Curve}

source - The curve to copy.

Attributes

Returns

{Curve} A reference to this curve.

def fromJSON(json: Object): Curve

Deserializes the curve from the given JSON.

Deserializes the curve from the given JSON.

Value parameters

{Object}

json - The JSON holding the serialized curve.

Attributes

Returns

{Curve} A reference to this curve.

def getLength(): Double

Returns the total arc length of the curve.

Returns the total arc length of the curve.

Attributes

Returns

{number} The length of the curve.

def getLengths(divisions: Double): Array[Double]

Returns an array of cumulative segment lengths of the curve.

Returns an array of cumulative segment lengths of the curve.

Value parameters

{number}

[divisions=this.arcLengthDivisions] - The number of divisions.

Attributes

Returns

{Array } An array holding the cumulative segment lengths.

def getPoint(t: Double, optionalTarget: UndefOr[Vector2 | Vector3]): Vector2 | Vector3

This method returns a vector in 2D or 3D space (depending on the curve definition) for the given interpolation factor.

This method returns a vector in 2D or 3D space (depending on the curve definition) for the given interpolation factor.

Value parameters

{(Vector2|Vector3)}

[optionalTarget] - The optional target vector the result is written to.

{number}

t - A interpolation factor representing a position on the curve. Must be in the range [0,1].

Attributes

Returns

{(Vector2|Vector3)} The position on the curve. It can be a 2D or 3D vector depending on the curve definition.

def getPointAt(u: Double, optionalTarget: UndefOr[Vector2 | Vector3]): Vector2 | Vector3

This method returns a vector in 2D or 3D space (depending on the curve definition) for the given interpolation factor. Unlike [[Curve#getPoint]], this method honors the length of the curve which equidistant samples.

This method returns a vector in 2D or 3D space (depending on the curve definition) for the given interpolation factor. Unlike [[Curve#getPoint]], this method honors the length of the curve which equidistant samples.

Value parameters

{(Vector2|Vector3)}

[optionalTarget] - The optional target vector the result is written to.

{number}

u - A interpolation factor representing a position on the curve. Must be in the range [0,1].

Attributes

Returns

{(Vector2|Vector3)} The position on the curve. It can be a 2D or 3D vector depending on the curve definition.

def getPoints(divisions: Double): Array[Vector2 | Vector3]

This method samples the curve via [[Curve#getPoint]] and returns an array of points representing the curve shape.

This method samples the curve via [[Curve#getPoint]] and returns an array of points representing the curve shape.

Value parameters

{number}

[divisions=5] - The number of divisions.

Attributes

Returns

{Array<(Vector2|Vector3)>} An array holding the sampled curve values. The number of points is divisions + 1.

def getSpacedPoints(divisions: Double): Array[Vector2 | Vector3]

This method samples the curve via [[Curve#getPointAt]] and returns an array of points representing the curve shape. Unlike [[Curve#getPoints]], this method returns equi-spaced points across the entire curve.

This method samples the curve via [[Curve#getPointAt]] and returns an array of points representing the curve shape. Unlike [[Curve#getPoints]], this method returns equi-spaced points across the entire curve.

Value parameters

{number}

[divisions=5] - The number of divisions.

Attributes

Returns

{Array<(Vector2|Vector3)>} An array holding the sampled curve values. The number of points is divisions + 1.

def getTangent(t: Double, optionalTarget: UndefOr[Vector2 | Vector3]): Vector2 | Vector3

Returns a unit vector tangent for the given interpolation factor. 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 a unit vector tangent for the given interpolation factor. 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.

Value parameters

{(Vector2|Vector3)}

[optionalTarget] - The optional target vector the result is written to.

{number}

t - The interpolation factor.

Attributes

Returns

{(Vector2|Vector3)} The tangent vector.

def getTangentAt(u: Double, optionalTarget: UndefOr[Vector2 | Vector3]): Vector2 | Vector3

Same as [[Curve#getTangent]] but with equidistant samples.

Same as [[Curve#getTangent]] but with equidistant samples.

Value parameters

{(Vector2|Vector3)}

[optionalTarget] - The optional target vector the result is written to.

{number}

u - The interpolation factor.

Attributes

Returns

{(Vector2|Vector3)} The tangent vector.

See also

[[Curve#getPointAt]]

def getUtoTmapping(u: Double, distance: UndefOr[Double]): Double

Given an interpolation factor in the range [0,1], this method returns an updated interpolation factor in the same range that can be ued to sample equidistant points from a curve.

Given an interpolation factor in the range [0,1], this method returns an updated interpolation factor in the same range that can be ued to sample equidistant points from a curve.

Value parameters

{?number}

distance - An optional distance on the curve.

{number}

u - The interpolation factor.

Attributes

Returns

{number} The updated interpolation factor.

def toJSON(): Object

Serializes the curve into JSON.

Serializes the curve into JSON.

Attributes

Returns

{Object} A JSON object representing the serialized curve.

See also

[[ObjectLoader#parse]]

def updateArcLengths(): Unit

Update the cumulative segment distance cache. The method must be called every time curve parameters are changed. If an updated curve is part of a composed curve like [[CurvePath]], this method must be called on the composed curve, too.

Update the cumulative segment distance cache. The method must be called every time curve parameters are changed. If an updated curve is part of a composed curve like [[CurvePath]], this method must be called on the composed curve, too.

Attributes

Inherited methods

def hasOwnProperty(v: String): Boolean

Attributes

Inherited from:
Object
def isPrototypeOf(v: Object): Boolean

Attributes

Inherited from:
Object
def propertyIsEnumerable(v: String): Boolean

Attributes

Inherited from:
Object
def toLocaleString(): String

Attributes

Inherited from:
Object
def valueOf(): Any

Attributes

Inherited from:
Object

Concrete fields

val `type`: String

The type property is used for detecting the object type in context of serialization/deserialization.

The type property is used for detecting the object type in context of serialization/deserialization.

Attributes

var arcLengthDivisions: Double

This value determines the amount of divisions when calculating the cumulative segment lengths of a curve via [[Curve#getLengths]]. To ensure precision when using methods like [[Curve#getSpacedPoints]], it is recommended to increase the value of this property if the curve is very large.

This value determines the amount of divisions when calculating the cumulative segment lengths of a curve via [[Curve#getLengths]]. To ensure precision when using methods like [[Curve#getSpacedPoints]], it is recommended to increase the value of this property if the curve is very large.

Attributes

var cacheArcLengths: Array[Double]

An internal cache that holds precomputed curve length values.

An internal cache that holds precomputed curve length values.

Attributes

var needsUpdate: Boolean

Must be set to true if the curve parameters have changed.

Must be set to true if the curve parameters have changed.

Attributes