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
32 lines (31 loc) • 927 B
TypeScript
/**
* Boolean operations on solids using OpenCASCADE WASM.
* All operations are async because WASM loading is async.
*/
export type BooleanOperation = "union" | "difference" | "intersection";
export type ShapeDescriptor = {
type: "box";
dx: number;
dy: number;
dz: number;
origin?: [number, number, number];
} | {
type: "cylinder";
radius: number;
height: number;
origin?: [number, number, number];
axis?: [number, number, number];
} | {
type: "sphere";
radius: number;
center?: [number, number, number];
};
export interface BooleanMeshResult {
vertices: Float32Array;
indices: Uint32Array;
normals: Float32Array;
}
/**
* Perform a boolean operation between two shape descriptors.
*/
export declare function booleanOperation(shapeA: ShapeDescriptor, shapeB: ShapeDescriptor, operation: BooleanOperation, meshDeflection?: number): Promise<BooleanMeshResult>;