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
33 lines (32 loc) • 1.38 kB
TypeScript
/**
* Adaptive surface tessellation.
* Subdivides cells where the surface deviates from the bilinear approximation
* by more than a tolerance, producing denser triangles in high-curvature areas.
*/
import { NurbsSurface } from "./surface";
export interface AdaptiveRefinementOptions {
/** Maximum deviation from bilinear approximation before subdividing (world units). Default: 0.01 */
tolerance?: number;
/** Maximum normal angle deviation before subdividing (radians). Default: undefined (disabled).
* When set, subdivides cells where the surface normal at the midpoint deviates from the
* interpolated corner normals by more than this angle. Verb-nurbs uses 0.025 rad (~1.4°). */
normalTolerance?: number;
/** Minimum number of initial divisions in U. Default: 4 */
minDivsU?: number;
/** Minimum number of initial divisions in V. Default: 4 */
minDivsV?: number;
/** Maximum recursion depth. Default: 6 */
maxDepth?: number;
/** Whether to compute normals. Default: true */
normals?: boolean;
}
export interface TessellationResult {
vertices: Float32Array;
normals: Float32Array;
uvs: Float32Array;
indices: Uint32Array;
}
/**
* Adaptively tessellate a NURBS surface.
*/
export declare function adaptiveTessellate(surface: NurbsSurface, options?: AdaptiveRefinementOptions): TessellationResult;