Interface Curve3D

Interface for interpolating points on a 3d curve

interface Curve3D {
    closed: boolean;
    getBoundingBox: (from?: number, to?: number) => { max: Vec3; min: Vec3 };
    getNormalAt: (pos: number) => Vec3;
    getPointAt: (pos: number) => Vec3;
    getPoints: (nSamples: number, from?: number, to?: number) => Vec3[];
    getTangentAt: (pos: number) => Vec3;
    length: number;
    nearest: (
        point: Vec3,
    ) => { distance: number; point: Vec3; position: number };
}

Properties

closed: boolean

when enabled, the curve will be closed having it's end point and start point joined

getBoundingBox: (from?: number, to?: number) => { max: Vec3; min: Vec3 }

get the bounding box of the full curve or optinally the segment between a from and/or to position

getNormalAt: (pos: number) => Vec3

get a normal at the normalized position (time) along the full curve (0 = start, 1 = end)

getPointAt: (pos: number) => Vec3

get a point at the normalized position (time) along the full curve (0 = start, 1 = end)

getPoints: (nSamples: number, from?: number, to?: number) => Vec3[]

get a number of samples along the curve, optionally specifying a start and end position

getTangentAt: (pos: number) => Vec3

get the tangent at the normalized position (time) along the full curve (0 = start, 1 = end)

length: number

the calculated length of the curve

nearest: (point: Vec3) => { distance: number; point: Vec3; position: number }

get the position, point and distance to this point from an abritary point