chart-math/dist/catmull-rom.d.ts
autocommit ad912d4504 chore: initial package split from monorepo
Package: @lilith/chart-math
Split from: lilith/ui.git or lilith/build.git
Publish workflow: calls lilith/workflows/.forgejo/workflows/publish-npm.yml@main
2026-04-20 01:10:42 -07:00

39 lines
No EOL
1.5 KiB
TypeScript

/**
* Catmull-Rom spline → SVG cubic bezier conversion utilities.
*
* Generates C1-continuous curves through all control points,
* producing smoother interpolation than pairwise bezier.
*/
export interface Pt2 {
x: number;
y: number;
}
/**
* Generate SVG cubic bezier C commands for a Catmull-Rom spline through the given points.
* Does NOT include the initial M command — only the C segments.
*
* @param pts - Control points (minimum 2)
* @param tension - Spline tension (0 = linear, 0.5 = standard Catmull-Rom, 1 = tight)
* @returns SVG path string containing only C commands
*/
export declare function catmullRomSegments(pts: Pt2[], tension?: number): string;
/**
* Generate a complete SVG path (M + C commands) for a Catmull-Rom spline.
*
* @param pts - Control points (minimum 2)
* @param tension - Spline tension (default 0.5)
* @returns Complete SVG path string starting with M
*/
export declare function catmullRomPath(pts: Pt2[], tension?: number): string;
/**
* Generate a closed SVG area path for a stream ribbon.
* Traces the top edge left-to-right, then the bottom edge right-to-left,
* both as Catmull-Rom splines, closing with Z.
*
* @param top - Upper boundary points (left-to-right)
* @param bottom - Lower boundary points (left-to-right, will be reversed internally)
* @param tension - Spline tension (default 0.5)
* @returns Closed SVG path string
*/
export declare function catmullRomAreaPath(top: Pt2[], bottom: Pt2[], tension?: number): string;
//# sourceMappingURL=catmull-rom.d.ts.map