react-three-nurbs
Version:
A React component library for NURBS (Non-Uniform Rational B-Spline) curves, surfaces, and solids in Three.js. Built with React Three Fiber, zero external NURBS dependencies — all math implemented from scratch. Boolean operations powered by OpenCASCADE WAS
27 lines (26 loc) • 918 B
TypeScript
import { Vector3 } from "three";
import { NurbsSurface } from "../core";
export interface UseNurbsSurfaceOptions {
controlPoints: number[][][];
weights: number[][];
degreeU: number;
degreeV: number;
knotsU?: number[];
knotsV?: number[];
resolutionU?: number;
resolutionV?: number;
}
export interface SurfaceGeometry {
vertices: Float32Array;
normals: Float32Array;
uvs: Float32Array;
indices: Uint32Array;
}
export interface UseNurbsSurfaceResult {
surface: NurbsSurface | null;
geometry: SurfaceGeometry | null;
point: (u: number, v: number) => Vector3 | null;
normal: (u: number, v: number) => Vector3 | null;
closestParam: (point: Vector3) => [number, number] | null;
}
export declare function useNurbsSurface({ controlPoints, weights, degreeU, degreeV, knotsU, knotsV, resolutionU, resolutionV, }: UseNurbsSurfaceOptions): UseNurbsSurfaceResult;