import type { Vec2 } from './Vec2'; export interface CubicBezierCurve { p0: Vec2; p1: Vec2; p2: Vec2; p3: Vec2; } export interface PointOnCurve { x: number; y: number; /** tangent angle in radians */ angle: number; } export declare class BezierPath { readonly curve: CubicBezierCurve; /** Total arc length of this curve in logical pixels */ readonly totalLength: number; /** * Flat LUT with LUT_SIZE+1 entries. * lut[i*3] = x position at sample i * lut[i*3+1] = y position at sample i * lut[i*3+2] = tangent angle at sample i */ readonly lut: Float64Array; /** * arcLen[i] = cumulative arc length from p0 to sample i. * Used by binary search in getPointAtLength(). */ private readonly arcLen; /** SVG path data string — used by canvas Path2D for edge tube drawing */ readonly svgD: string; constructor(curve: CubicBezierCurve); /** * Returns the point at arc-length `distance` along the curve. * Clamps to [0, totalLength]. O(log n) via binary search. */ getPointAtLength(distance: number): PointOnCurve; /** * Returns the unit tangent vector at arc-length `distance`. */ getTangentAtLength(distance: number): Vec2; /** * Find the closest point on the curve to a given point. * Uses LUT scan — O(LUT_SIZE). Returns arc-length distance and position. * Used by InteractionSystem for edge hit testing. */ closestPoint(px: number, py: number): { distance: number; point: PointOnCurve; distSq: number; }; /** Binary search: returns largest i such that arcLen[i] <= target */ private binarySearchArc; /** * Build a bezier from source boundary point to target boundary point. * Control points are derived from the center-to-center perpendicular, * preserving smooth curvature regardless of where the boundary points land. * * @param source Start point (source node boundary) * @param target End point (target node boundary) * @param srcCenter Source node center (for control point calculation) * @param tgtCenter Target node center (for control point calculation) * @param curvature Perpendicular offset scale (signed, default 0.3) * @param offset Additional offset for the mid control point */ /** * Build an arc-length-parameterized cubic bezier. * * `curvature` controls the perpendicular offset at the source-side control * point (p1, placed at ~1/3 of the chord). * * `curvature2` controls the perpendicular offset at the target-side control * point (p2, placed at ~2/3 of the chord). When omitted it equals * `curvature` → symmetric arc. When different it produces asymmetric arcs * or S-curves (opposite signs), giving organic / freeform paths. */ static fromBoundaryPoints(source: Vec2, target: Vec2, srcCenter: Vec2, tgtCenter: Vec2, curvature?: number, curvature2?: number, offset?: Vec2): BezierPath; /** * Simple center-to-center bezier (backward-compat helper). */ static fromCenters(source: Vec2, target: Vec2, curvature?: number, curvature2?: number, offset?: Vec2): BezierPath; } //# sourceMappingURL=Bezier.d.ts.map