Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Module

x/threejs_4_deno/src/extras/core/Curve.js>Curve

A simple transformation of three.js for use within a Deno workflow
Go to Latest
class Curve
import { Curve } from "https://deno.land/x/threejs_4_deno@v121/src/extras/core/Curve.js";

An extensible curve object which contains methods for interpolation class Curve

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.

type: string

Methods

copy(source: Curve<T>): this
fromJSON(json: object): this
getLength(): number

Get total curve arc length

getLengths(divisions?: number): number[]

Get list of cumulative segment lengths

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

Returns a vector for point t of the curve where t is between 0 and 1 getPoint(t: number, optionalTarget?: T): T;

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

Returns a vector for point at relative position in curve according to arc length getPointAt(u: number, optionalTarget?: T): T;

getPoints(divisions?: number): T[]

Get sequence of points using getPoint( t ) getPoints(divisions?: number): T[];

getSpacedPoints(divisions?: number): T[]

Get sequence of equi-spaced points using getPointAt( u ) getSpacedPoints(divisions?: number): T[];

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

Returns a unit vector tangent at t. If the subclassed curve do not implement its tangent derivation, 2 points a small delta apart will be used to find its gradient which seems to give a reasonable approximation getTangent(t: number, optionalTarget?: T): T;

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

Returns tangent at equidistance point u on the curve getTangentAt(u: number, optionalTarget?: T): T;

getUtoTmapping(u: number, distance: number): number

Given u ( 0 .. 1 ), get a t to find p. This gives you points which are equi distance

toJSON(): object

Update the cumlative segment distance cache

Static Methods

deprecated
create(constructorFunc: Function, getPointFunc: Function): Function