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
31 lines (30 loc) • 1.33 kB
TypeScript
/**
* NURBS modification operations.
* Implements Algorithms A5.1, A5.4, A5.9 from "The NURBS Book" (Piegl & Tiller).
*/
import type { CurveData, SurfaceData } from "./types";
/**
* Insert a single knot u into a curve r times.
* Uses Boehm's algorithm, operating on control points and weights separately.
*/
export declare function curveKnotInsert(curve: CurveData, u: number, r: number): CurveData;
/**
* Refine a curve by inserting multiple knots (Algorithm A5.4).
*/
export declare function curveKnotRefine(curve: CurveData, knotsToInsert: number[]): CurveData;
/**
* Refine a surface by inserting knots in U or V direction.
*/
export declare function surfaceKnotRefine(surface: SurfaceData, knotsToInsert: number[], useV: boolean): SurfaceData;
/**
* Elevate the degree of a curve (simplified approach: insert all interior knots
* to get Bezier segments, elevate each, then remove unnecessary knots).
* For the initial implementation, we use a simpler approach via knot insertion.
*/
export declare function curveElevateDegree(curve: CurveData, finalDegree: number): CurveData;
/**
* Unify knot vectors across multiple curves:
* 1. Elevate all to the maximum degree
* 2. Merge all knot vectors and refine each curve to the union
*/
export declare function unifyCurveKnots(curves: CurveData[]): CurveData[];