@ue-too/curve 0.9.5 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +472 -4
- package/b-curve.d.ts +86 -0
- package/composite-curve.d.ts +16 -0
- package/index.d.ts +96 -0
- package/index.js +2 -1590
- package/index.js.map +6 -6
- package/line.d.ts +29 -0
- package/package.json +2 -2
- package/path.d.ts +4 -0
package/index.d.ts
CHANGED
|
@@ -1,3 +1,99 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @packageDocumentation
|
|
3
|
+
* Bezier curve and geometric path library for TypeScript.
|
|
4
|
+
*
|
|
5
|
+
* @remarks
|
|
6
|
+
* The `@ue-too/curve` package provides comprehensive tools for working with Bezier curves,
|
|
7
|
+
* lines, and composite paths. It includes advanced features like curve intersection detection,
|
|
8
|
+
* offset curves, arc fitting, and arc-length parameterization.
|
|
9
|
+
*
|
|
10
|
+
* ## Core Components
|
|
11
|
+
*
|
|
12
|
+
* - **{@link BCurve}**: Bezier curve (quadratic and cubic) with extensive geometric operations
|
|
13
|
+
* - **{@link Line}**: Straight line segment with intersection and projection utilities
|
|
14
|
+
* - **{@link CompositeBCurve}**: Composite Bezier curve with control points and handles
|
|
15
|
+
* - **{@link Path}**: Sequential path made of line segments
|
|
16
|
+
*
|
|
17
|
+
* ## Key Features
|
|
18
|
+
*
|
|
19
|
+
* ### Bezier Curve Operations
|
|
20
|
+
* - Evaluate curves at any parameter t
|
|
21
|
+
* - Split curves at any point
|
|
22
|
+
* - Calculate arc length with caching
|
|
23
|
+
* - Find derivatives and curvature
|
|
24
|
+
* - Detect self-intersections and curve-to-curve intersections
|
|
25
|
+
*
|
|
26
|
+
* ### Geometric Queries
|
|
27
|
+
* - Project points onto curves
|
|
28
|
+
* - Find closest points on curves
|
|
29
|
+
* - Calculate bounding boxes (AABB)
|
|
30
|
+
* - Detect intersections with lines, circles, and other curves
|
|
31
|
+
* - Fit arcs to curve segments
|
|
32
|
+
*
|
|
33
|
+
* ### Advanced Features
|
|
34
|
+
* - Offset curves (parallel curves at distance)
|
|
35
|
+
* - Arc-length parameterization for uniform spacing
|
|
36
|
+
* - Curve reduction and simplification
|
|
37
|
+
* - Normal and tangent vector calculation
|
|
38
|
+
* - Extrema detection (min/max x and y values)
|
|
39
|
+
*
|
|
40
|
+
* ## Main Exports
|
|
41
|
+
*
|
|
42
|
+
* - {@link BCurve} - Bezier curve class (2-4 control points)
|
|
43
|
+
* - {@link Line} - Line segment class
|
|
44
|
+
* - {@link CompositeBCurve} - Composite curve with handles
|
|
45
|
+
* - {@link ControlPoint} - Control point with left/right handles
|
|
46
|
+
* - {@link Path} - Path composed of line segments
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* Basic Bezier curve
|
|
50
|
+
* ```typescript
|
|
51
|
+
* import { BCurve } from '@ue-too/curve';
|
|
52
|
+
*
|
|
53
|
+
* // Create a quadratic Bezier curve
|
|
54
|
+
* const curve = new BCurve([
|
|
55
|
+
* { x: 0, y: 0 },
|
|
56
|
+
* { x: 50, y: 100 },
|
|
57
|
+
* { x: 100, y: 0 }
|
|
58
|
+
* ]);
|
|
59
|
+
*
|
|
60
|
+
* // Evaluate at midpoint
|
|
61
|
+
* const midpoint = curve.get(0.5);
|
|
62
|
+
*
|
|
63
|
+
* // Get the total length
|
|
64
|
+
* console.log('Length:', curve.fullLength);
|
|
65
|
+
*
|
|
66
|
+
* // Split the curve
|
|
67
|
+
* const [left, right] = curve.splitIntoCurves(0.5);
|
|
68
|
+
* ```
|
|
69
|
+
*
|
|
70
|
+
* @example
|
|
71
|
+
* Curve intersections
|
|
72
|
+
* ```typescript
|
|
73
|
+
* import { BCurve } from '@ue-too/curve';
|
|
74
|
+
*
|
|
75
|
+
* const curve1 = new BCurve([
|
|
76
|
+
* { x: 0, y: 0 },
|
|
77
|
+
* { x: 50, y: 100 },
|
|
78
|
+
* { x: 100, y: 0 }
|
|
79
|
+
* ]);
|
|
80
|
+
*
|
|
81
|
+
* const curve2 = new BCurve([
|
|
82
|
+
* { x: 0, y: 50 },
|
|
83
|
+
* { x: 50, y: -50 },
|
|
84
|
+
* { x: 100, y: 50 }
|
|
85
|
+
* ]);
|
|
86
|
+
*
|
|
87
|
+
* // Find intersections
|
|
88
|
+
* const intersections = curve1.getCurveIntersections(curve2);
|
|
89
|
+
* intersections.forEach(({selfT, otherT}) => {
|
|
90
|
+
* console.log('Intersection at t1:', selfT, 't2:', otherT);
|
|
91
|
+
* });
|
|
92
|
+
* ```
|
|
93
|
+
*
|
|
94
|
+
* @see {@link BCurve} for the main Bezier curve class
|
|
95
|
+
* @see {@link Line} for line segment utilities
|
|
96
|
+
*/
|
|
1
97
|
export * from "./b-curve";
|
|
2
98
|
export * from "./line";
|
|
3
99
|
export * from "./composite-curve";
|