videx-3d
Version:
React 3D component library designed for sub surface visualizations in the browser
38 lines (37 loc) • 1.09 kB
TypeScript
import { Vec3 } from '../../types/common';
/**
* Interface for interpolating points on a 3d curve
*/
export interface Curve3D {
getPointAt: (pos: number) => Vec3;
getPoints: (nSamples: number, from?: number, to?: number) => Vec3[];
getTangentAt: (pos: number) => Vec3;
getNormalAt: (pos: number) => Vec3;
getBoundingBox: (from?: number, to?: number) => {
min: Vec3;
max: Vec3;
};
nearest: (point: Vec3) => {
position: number;
point: Vec3;
distance: number;
};
length: number;
closed: boolean;
}
/**
* Returns an implementation of `SplineCurve` using `CurveInterpolator`
**/
export declare function getSplineCurve(points: Vec3[], closed?: boolean): Curve3D | null;
export type FrenetFrame = {
curvePosition: number;
position: Vec3;
tangent: Vec3;
normal: Vec3;
binormal: Vec3;
};
/**
* Calculate a stable and balanced set of Frenet Frames for a curve at the
* specified positions.
*/
export declare function calculateFrenetFrames(curve: Curve3D, curvePositions: number[]): FrenetFrame[];