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

26 lines (25 loc) 1 kB
import type { ThreeEvent } from "@react-three/fiber"; export interface ControlPointHandle { position: [number, number, number]; index: number[]; bind: { onPointerDown: (e: ThreeEvent<PointerEvent>) => void; }; } export interface UseControlPointDragOptions { controlPoints: number[][][] | number[][]; onControlPointChange: (newPoints: number[][][] | number[][], index: number[]) => void; dragPlane?: "xy" | "xz" | "yz" | "screen"; handleSize?: number; } export interface UseControlPointDragResult { handles: ControlPointHandle[]; isDragging: boolean; activeIndex: number[] | null; /** Spread this on a large invisible mesh to capture drag events */ dragBind: { onPointerMove: (e: ThreeEvent<PointerEvent>) => void; onPointerUp: (e: ThreeEvent<PointerEvent>) => void; }; } export declare function useControlPointDrag({ controlPoints, onControlPointChange, dragPlane, }: UseControlPointDragOptions): UseControlPointDragResult;