Spaces:
Sleeping
Sleeping
File size: 2,683 Bytes
2b7aae2 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 | import { Vector } from './../../math/Vector2';
import { Vector3 } from './../../math/Vector3';
// Extras / Core /////////////////////////////////////////////////////////////////////
/**
* An extensible curve object which contains methods for interpolation
* class Curve<T extends Vector>
*/
export class Curve<T extends Vector> {
/**
* @default 'Curve'
*/
type: string;
/**
* 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 200
*/
arcLengthDivisions: number;
/**
* Returns a vector for point t of the curve where t is between 0 and 1
* getPoint(t: number, optionalTarget?: T): T;
*/
getPoint(t: number, optionalTarget?: T): T;
/**
* Returns a vector for point at relative position in curve according to arc length
* getPointAt(u: number, optionalTarget?: T): T;
*/
getPointAt(u: number, optionalTarget?: T): T;
/**
* Get sequence of points using getPoint( t )
* getPoints(divisions?: number): T[];
*/
getPoints(divisions?: number): T[];
/**
* Get sequence of equi-spaced points using getPointAt( u )
* getSpacedPoints(divisions?: number): T[];
*/
getSpacedPoints(divisions?: number): T[];
/**
* Get total curve arc length
*/
getLength(): number;
/**
* Get list of cumulative segment lengths
*/
getLengths(divisions?: number): number[];
/**
* Update the cumlative segment distance cache
*/
updateArcLengths(): void;
/**
* Given u ( 0 .. 1 ), get a t to find p. This gives you points which are equi distance
*/
getUtoTmapping(u: number, distance: number): number;
/**
* 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;
*/
getTangent(t: number, optionalTarget?: T): T;
/**
* Returns tangent at equidistance point u on the curve
* getTangentAt(u: number, optionalTarget?: T): T;
*/
getTangentAt(u: number, optionalTarget?: T): T;
/**
* Generate Frenet frames of the curve
*/
computeFrenetFrames(
segments: number,
closed?: boolean
): {
tangents: Vector3[];
normals: Vector3[];
binormals: Vector3[];
};
clone(): this;
copy(source: Curve<T>): this;
toJSON(): object;
fromJSON(json: object): this;
/**
* @deprecated since r84.
*/
static create(constructorFunc: () => void, getPointFunc: () => void): () => void;
}
|