Capítulo 341 de 859

Chapter 341: Curve

Core Idea

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

Key Concepts

  • arcLengthDivisions : number: This value determines the amount of divisions when calculating the cumulative segment lengths of a curve via [Curve#getLengths](Curve.html#…
  • needsUpdate : boolean: Must be set to true if the curve parameters have changed.
  • type : string (readonly): The type property is used for detecting the object type in context of serialization/deserialization.

Reference Tables

Constructor

Signature
new Curve() (abstract)

Properties

PropertyDescription
.arcLengthDivisions : numberThis 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 [Cu…
.needsUpdate : booleanMust be set to true if the curve parameters have changed.
.type : string (readonly)The type property is used for detecting the object type in context of serialization/deserialization.

Methods

MethodDescription
.clone() : CurveReturns a new curve with copied values from this instance.
.computeFrenetFrames( segments : number, closed : boolean ) : ObjectGenerates the Frenet Frames. Requires a curve definition in 3D space. Used in geometries like TubeGeometry or ExtrudeGeometry.
.copy( source : Curve ) : CurveCopies the values of the given curve to this instance.
.fromJSON( json : Object ) : CurveDeserializes the curve from the given JSON.
.getLength() : numberReturns the total arc length of the curve.
.getLengths( divisions : number ) : Array.<number>Returns an array of cumulative segment lengths of the curve.
`.getPoint( t : number, optionalTarget : Vector2Vector3 ) : Vector2
`.getPointAt( u : number, optionalTarget : Vector2Vector3 ) : Vector2
`.getPoints( divisions : number ) : Array.<(Vector2Vector3)>`
`.getSpacedPoints( divisions : number ) : Array.<(Vector2Vector3)>`
`.getTangent( t : number, optionalTarget : Vector2Vector3 ) : Vector2
`.getTangentAt( u : number, optionalTarget : Vector2Vector3 ) : Vector2
.getUtoTmapping( u : number, distance : number ) : numberGiven 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.
.toJSON() : ObjectSerializes the curve into JSON.
.updateArcLengths()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…

Key Takeaways

  1. Most relevant properties: arcLengthDivisions, needsUpdate, type.
  2. Key methods: clone, computeFrenetFrames, copy, fromJSON.

Connects To