UNPKG

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

42 lines (41 loc) 2.1 kB
/** * NURBS solid — a closed volume bounded by oriented NURBS faces. */ import type { FaceData, SolidData, CurveData, SurfaceData } from "./types"; export declare class NurbsSolid { private _faces; constructor(data: SolidData); static fromFaces(faces: FaceData[]): NurbsSolid; static makeBox(dx: number, dy: number, dz: number, origin?: [number, number, number]): NurbsSolid; static makeCylinder(radius: number, height: number, axis?: [number, number, number], origin?: [number, number, number]): NurbsSolid; static makeSphere(radius: number, center?: [number, number, number]): NurbsSolid; /** * Create a solid by revolving a closed curve profile around an axis. * The profile should be a closed loop (or the revolution will close it). * Result: 1 revolved surface face. */ static fromRevolution(profile: CurveData, center?: [number, number, number], axis?: [number, number, number], angle?: number, capped?: boolean): NurbsSolid; /** * Create a solid by extruding a closed curve profile along a direction. * Result: 1 extruded surface (sides) + 2 caps. * Caps use a degenerate surface where one edge matches the profile exactly * and the opposite edge collapses to the centroid. */ static fromExtrusion(profile: CurveData, direction: [number, number, number], capped?: boolean): NurbsSolid; /** * Create a solid by thickening a surface. * Offsets the surface by `thickness` along its normal direction, * creating two faces (original + offset) connected by side surfaces. * Simplified version: returns original + offset face only. */ static fromSurface(surface: SurfaceData, thickness: number): NurbsSolid; /** * Create a solid face from a surface (wraps it as a FaceData). * Useful for composing solids from individual surfaces. */ static faceFromSurface(surface: SurfaceData, orientation?: "forward" | "reversed", trimCurves?: CurveData[]): FaceData; faces(): FaceData[]; numFaces(): number; asData(): SolidData; clone(): NurbsSolid; }