Skip to content

@orillusion/core


Class: CubicBezierPath ​

Defined in: src/math/CubicBezierPath.ts:17

Constructors ​

Constructor ​

new CubicBezierPath(controlVertices, t?): CubicBezierPath

Defined in: src/math/CubicBezierPath.ts:26

Parameters ​

controlVertices ​

Vector3[]

t? ​

CubicBezierType = CubicBezierType.Open

Returns ​

CubicBezierPath

Methods ​

getPathType() ​

getPathType(): CubicBezierType

Defined in: src/math/CubicBezierPath.ts:31

Return the path type (open or closed).

Returns ​

CubicBezierType


isClosed() ​

isClosed(): boolean

Defined in: src/math/CubicBezierPath.ts:36

Return true if the path is closed.

Returns ​

boolean


isValid() ​

isValid(): boolean

Defined in: src/math/CubicBezierPath.ts:43

Returns ​

boolean


clear() ​

clear(): void

Defined in: src/math/CubicBezierPath.ts:48

Reset the path to empty, open state with no control vertices or segments.

Returns ​

void


computeApproxLength() ​

computeApproxLength(): number

Defined in: src/math/CubicBezierPath.ts:56

Compute an approximate path length by summing squared distances between interpolated points.

Returns ​

number


computeApproxParamPerUnitLength() ​

computeApproxParamPerUnitLength(): number

Defined in: src/math/CubicBezierPath.ts:78

Return the approximate change in the raw parameter t per unit of path length.

Returns ​

number


computeApproxNormParamPerUnitLength() ​

computeApproxNormParamPerUnitLength(): number

Defined in: src/math/CubicBezierPath.ts:84

Return the approximate change in the normalized parameter t per unit of path length.

Returns ​

number


interpolatePoints() ​

interpolatePoints(knots, t): void

Defined in: src/math/CubicBezierPath.ts:90

Build the path from interpolated knots, generating interior control vertices automatically (knots.length must be >= 2).

Parameters ​

knots ​

Vector3[]

t ​

CubicBezierType

Returns ​

void


setControlVertices() ​

setControlVertices(cvs, t): void

Defined in: src/math/CubicBezierPath.ts:187

Set the path directly from explicit control vertices; for a closed path the last CV must match the first.

Parameters ​

cvs ​

Vector3[]

t ​

CubicBezierType

Returns ​

void


getPoint() ​

getPoint(t): Vector3

Defined in: src/math/CubicBezierPath.ts:203

Return the point on the path at parameter t in [0, numSegments]; closed paths wrap out-of-range t.

Parameters ​

t ​

number

Returns ​

Vector3


getPointNorm() ​

getPointNorm(t): Vector3

Defined in: src/math/CubicBezierPath.ts:234

Return the point on the path at normalized parameter t in [0, 1] over all segments.

Parameters ​

t ​

number

Returns ​

Vector3


getTangent() ​

getTangent(t): Vector3

Defined in: src/math/CubicBezierPath.ts:241

Return the (un-normalized) tangent on the path at parameter t in [0, numSegments].

Parameters ​

t ​

number

Returns ​

Vector3


getTangentNorm() ​

getTangentNorm(t): Vector3

Defined in: src/math/CubicBezierPath.ts:270

Return the (un-normalized) tangent at normalized parameter t in [0, 1] over all segments.

Parameters ​

t ​

number

Returns ​

Vector3


computeClosestParam() ​

computeClosestParam(pos, paramThreshold): number

Defined in: src/math/CubicBezierPath.ts:278

Find the parameter t of the closest point on the path to pos, searching with the given param threshold.

Parameters ​

pos ​

Vector3

paramThreshold ​

number

Returns ​

number


computeClosestNormParam() ​

computeClosestNormParam(pos, paramThreshold): number

Defined in: src/math/CubicBezierPath.ts:304

Like computeClosestParam but returns the closest point as a normalized parameter t in [0, 1].

Parameters ​

pos ​

Vector3

paramThreshold ​

number

Returns ​

number