@ac-kit/math-curves 0.1.10 → 0.2.1

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/CHANGELOG.md CHANGED
@@ -1,5 +1,125 @@
1
1
  # @ac-kit/math-curves
2
2
 
3
+ ## 0.2.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 0b4fe43: `monotoneCubicSpline2`, `naturalCubicSpline2`, `uniformBSpline2` and
8
+ `cardinalSpline2` allocate nothing: the first two no longer keep tangents and
9
+ moments in arrays of their own. `out` may still share memory with `points`, at
10
+ any offset and even through two wrappers of one `SharedArrayBuffer`; the points
11
+ are then copied into a buffer the module keeps and grows to the largest such
12
+ input, so only an overlapping input larger than any before allocates. The
13
+ samples are unchanged but for the last bits of the natural spline's.
14
+ - Updated dependencies [0b4fe43]
15
+ - Updated dependencies [0b4fe43]
16
+ - Updated dependencies [0b4fe43]
17
+ - Updated dependencies [0b4fe43]
18
+ - Updated dependencies [0b4fe43]
19
+ - Updated dependencies [0b4fe43]
20
+ - Updated dependencies [0b4fe43]
21
+ - Updated dependencies [0b4fe43]
22
+ - Updated dependencies [0b4fe43]
23
+ - Updated dependencies [0b4fe43]
24
+ - Updated dependencies [0b4fe43]
25
+ - Updated dependencies [0b4fe43]
26
+ - Updated dependencies [0b4fe43]
27
+ - Updated dependencies [0b4fe43]
28
+ - Updated dependencies [0b4fe43]
29
+ - Updated dependencies [0b4fe43]
30
+ - Updated dependencies [0b4fe43]
31
+ - Updated dependencies [0b4fe43]
32
+ - Updated dependencies [0b4fe43]
33
+ - Updated dependencies [0b4fe43]
34
+ - @ac-kit/core@0.13.0
35
+ - @ac-kit/math-linear@0.4.0
36
+
37
+ ## 0.2.0
38
+
39
+ ### Minor Changes
40
+
41
+ - 34e8cfa: `quadraticBezier2` and `cubicBezier2` follow the out-first standard of
42
+ `@ac-kit/math-linear`: `out` comes first, is written and returned, and may be
43
+ any of the points, so nothing is allocated. Points are the branded `Vec2`, so an
44
+ array literal no longer type-checks.
45
+
46
+ Accuracy changes with the contract: 0.1.10 evaluated each coordinate as a
47
+ compensated sum, correct to the last bit even when the weighted terms cancel;
48
+ the result is now an ordinary floating-point sum of the weighted coordinates.
49
+ It matches the old results to a few units in the last place only when the
50
+ weighted terms do not cancel. Whenever they can, whatever the magnitudes of
51
+ the coordinates, digits can be lost, up to all of them: at `t = 0.5`, x
52
+ coordinates `[2**55, 1, -(2**55)]` give `0` where 0.1.10 gave `0.5`, and
53
+ `[2**55+8, 2**55, -3*2**55]` give `0` where 0.1.10 gave the exact `2`. Translate such a
54
+ curve before evaluating it.
55
+
56
+ Migration:
57
+
58
+ ```ts
59
+ // before
60
+ const point = cubicBezier2([0, 0], [0, 1], [1, 1], [1, 0], 0.5);
61
+ // after
62
+ const point = cubicBezier2(
63
+ vec2Create(),
64
+ vec2Of(0, 0),
65
+ vec2Of(0, 1),
66
+ vec2Of(1, 1),
67
+ vec2Of(1, 0),
68
+ 0.5,
69
+ );
70
+ ```
71
+
72
+ The package no longer depends on `@ac-kit/math-scalar`.
73
+ - 34e8cfa: New: `quadraticBezier2Flatten` and `cubicBezier2Flatten` write a polyline whose
74
+ every point is within `tolerance` of the curve into a caller's `Float64Array`
75
+ (vertices after the start point, all on the curve, the last one exactly the end
76
+ point) and return how many they wrote. The flattening is adaptive: chords follow
77
+ the curvature, close to the fewest a tolerance allows, so a curve whose bend is
78
+ concentrated gets far fewer vertices than uniform parameter steps would give.
79
+ `quadraticBezier2FlattenCount` and `cubicBezier2FlattenCount` give an upper
80
+ bound on that count before any vertex is written, to size `out` (`RangeError`
81
+ when it is too short). A tolerance that is zero, negative or NaN, like NaN or
82
+ infinite points, gives a count of 1 and the single vertex (NaN, NaN). Results
83
+ hold while the points' differences and the tolerance lie within about
84
+ [1e−150, 1e150], and up to the rounding of the written coordinates: a curve far
85
+ from the origin keeps its digits, but a tolerance below the coordinates' ulp
86
+ cannot be met.
87
+
88
+ `cubicHermite2Sample(out, offset, p0, m0, p1, m1, samples)` writes `samples`
89
+ points of a cubic Hermite span after `p0`, the last exactly `p1`.
90
+
91
+ Four samplers through `Vec2` buffers, `samples` points per span:
92
+ `monotoneCubicSpline2` (Fritsch–Carlson), `naturalCubicSpline2`,
93
+ `uniformBSpline2` and `cardinalSpline2`. Flat runs stay exactly flat, uniformly
94
+ tiny or huge steps give finite samples, and `out` may share memory with
95
+ `points`, including through wrappers of one `SharedArrayBuffer`.
96
+
97
+ ### Patch Changes
98
+
99
+ - Updated dependencies [34e8cfa]
100
+ - Updated dependencies [34e8cfa]
101
+ - Updated dependencies [34e8cfa]
102
+ - Updated dependencies [34e8cfa]
103
+ - Updated dependencies [34e8cfa]
104
+ - Updated dependencies [34e8cfa]
105
+ - Updated dependencies [34e8cfa]
106
+ - Updated dependencies [34e8cfa]
107
+ - Updated dependencies [34e8cfa]
108
+ - Updated dependencies [34e8cfa]
109
+ - Updated dependencies [34e8cfa]
110
+ - Updated dependencies [34e8cfa]
111
+ - Updated dependencies [34e8cfa]
112
+ - Updated dependencies [34e8cfa]
113
+ - Updated dependencies [34e8cfa]
114
+ - Updated dependencies [34e8cfa]
115
+ - Updated dependencies [34e8cfa]
116
+ - Updated dependencies [34e8cfa]
117
+ - Updated dependencies [34e8cfa]
118
+ - Updated dependencies [34e8cfa]
119
+ - Updated dependencies [34e8cfa]
120
+ - @ac-kit/core@0.12.0
121
+ - @ac-kit/math-linear@0.3.0
122
+
3
123
  ## 0.1.10
4
124
 
5
125
  ### Patch Changes
package/README.md CHANGED
@@ -9,14 +9,68 @@ A curve is a map from a scalar parameter to a point. That is the boundary of
9
9
  this package: anything parameterised by `t` belongs here, anything defined by a
10
10
  boundary or an area belongs in `@ac-kit/math-geometry`.
11
11
 
12
- Points are the `Vec2` and `Vec3` tuples from `@ac-kit/math-linear`.
12
+ Points are the `Vec2` and `Vec3` tuples from `@ac-kit/math-linear`, made with
13
+ its creators (`vec2Of(x, y)`); every function that produces points takes the
14
+ destination `out` first and writes into it, and the `…FlattenCount` bounds only
15
+ return a number.
13
16
 
14
17
  ## Contents
15
18
 
16
19
  | Symbol | Description |
17
20
  | --------------------------------- | --------------------------------------- |
18
- | `quadraticBezier2(p0, p1, p2, t)` | Quadratic Bézier in the Bernstein basis |
19
- | `cubicBezier2(p0, p1, p2, p3, t)` | Cubic Bézier in the Bernstein basis |
21
+ | `quadraticBezier2(out, p0, p1, p2, t)` | Quadratic Bézier in the Bernstein basis |
22
+ | `cubicBezier2(out, p0, p1, p2, p3, t)` | Cubic Bézier in the Bernstein basis |
23
+
24
+ Polylines and sampled curves write into a `Float64Array` you own, out first,
25
+ two numbers (x, y) per point:
26
+
27
+ | Symbol | Description |
28
+ | -------------------------------------------------------------- | ----------------------------------------------------------------------------------- |
29
+ | `quadraticBezier2Flatten(out, offset, p0, p1, p2, tolerance)` | Adaptive polyline within `tolerance` of the curve; writes the vertices after `p0` |
30
+ | `cubicBezier2Flatten(out, offset, p0, p1, p2, p3, tolerance)` | The same for a cubic |
31
+ | `quadraticBezier2FlattenCount(p0, p1, p2, tolerance)` | Upper bound on the vertices `…Flatten` writes, the size to give `out` (`2 ×` numbers) |
32
+ | `cubicBezier2FlattenCount(p0, p1, p2, p3, tolerance)` | The same for a cubic |
33
+ | `cubicHermite2Sample(out, offset, p0, m0, p1, m1, samples)` | `samples` points of the cubic Hermite span after `p0`, the last exactly `p1` |
34
+ | `monotoneCubicSpline2(out, points, samples)` | Fritsch–Carlson monotone interpolant of points sorted by x (no overshoot) |
35
+ | `naturalCubicSpline2(out, points, samples)` | `C²` interpolating spline, zero end curvature |
36
+ | `uniformBSpline2(out, points, samples)` | Uniform cubic B-spline (smoothing, not interpolating), ends at the end points |
37
+ | `cardinalSpline2(out, points, samples, tension)` | Interpolating cardinal spline (`tension = 0`: Catmull–Rom) |
38
+
39
+ `…Flatten` is adaptive: chords are long where the curve is flat and short
40
+ where it bends, each one checked against a bound on its distance to the curve,
41
+ and their number stays within a few percent of the curvature-integral optimum
42
+ (far fewer than uniform parameter steps on a curve whose bend is concentrated).
43
+ `…FlattenCount` is the uniform-step count of Wang's formula, which `…Flatten`
44
+ never exceeds: `out` needs `offset + 2 · …FlattenCount(…)` numbers, else a
45
+ `RangeError`, and the returned count says how many were written. A `tolerance`
46
+ that is zero, negative or NaN is degenerate input, like NaN or infinite points:
47
+ the count is 1 and `…Flatten` writes the single vertex (NaN, NaN); `Infinity`
48
+ gives the single chord. Only a bad `offset` or a short `out` throws.
49
+
50
+ The spline samplers write the first point, then `samples` points per span, the
51
+ last of each span exactly its end point (`((n − 1) · samples + 1) · 2`
52
+ numbers). Flat runs stay exactly flat. They allocate nothing: the tangents
53
+ and the natural spline's elimination are kept in `out` until the samples
54
+ replace them. `out` may share memory with `points`, even through two wrappers
55
+ of one `SharedArrayBuffer`; the points are then copied first, into a buffer the
56
+ module keeps and grows to the largest such input, so only a larger
57
+ overlapping input than any before allocates.
58
+
59
+ ## Range of the arithmetic
60
+
61
+ Lengths, slopes and tangents use plain arithmetic, as in
62
+ `@ac-kit/math-linear` (`Math.sqrt` of sums of squares). Results are guaranteed
63
+ while the differences between the points (and the flattening tolerance) lie
64
+ within about [1e−150, 1e150]. A uniformly tiny or huge curve is fine, since
65
+ counts and slopes are computed on differences scaled by their largest; what
66
+ fails is a mix beyond that range: a bend 1e−400 times the curve's extent is
67
+ lost, a subnormal step beside a unit one overflows a slope, and tangents or
68
+ bends near 1e308 overflow to `Infinity` or `NaN`.
69
+
70
+ Coordinates are evaluated relative to the first point, so a curve far from the
71
+ origin keeps its digits, but the written coordinates round to their ulp: a
72
+ flattening tolerance must exceed the ulp of the coordinates (2 at 1e16) to be
73
+ met, and below it the polyline misses by up to that rounding.
20
74
 
21
75
  ## Parameter is not arc length
22
76
 
@@ -30,8 +84,10 @@ length reparameterisation rather than the raw parameter.
30
84
 
31
85
  ```ts
32
86
  import { cubicBezier2 } from "@ac-kit/math-curves";
87
+ import { vec2Create, vec2Of } from "@ac-kit/math-linear";
33
88
 
34
- cubicBezier2([0, 0], [0, 1], [1, 1], [1, 0], 0.5); // [0.5, 0.75]
89
+ const out = vec2Create();
90
+ cubicBezier2(out, vec2Of(0, 0), vec2Of(0, 1), vec2Of(1, 1), vec2Of(1, 0), 0.5); // [0.5, 0.75]
35
91
  ```
36
92
 
37
93
  See the
@@ -0,0 +1,2 @@
1
+ export declare function cubicHermite2Samples_(out: Float64Array, offset: number, samples: number, x0: number, y0: number, tangentX0: number, tangentY0: number, x1: number, y1: number, tangentX1: number, tangentY1: number): number;
2
+ //# sourceMappingURL=_hermite2-samples.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"_hermite2-samples.d.ts","sourceRoot":"","sources":["../src/_hermite2-samples.ts"],"names":[],"mappings":"AAeA,wBAAgB,qBAAqB,CACpC,GAAG,EAAE,YAAY,EACjB,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,EACf,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,EACV,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,EACjB,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,EACV,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,GACf,MAAM,CAqBR"}
@@ -0,0 +1,34 @@
1
+ // The cubic Hermite span H(u) = h₀₀·p0 + h₁₀·m0 + h₀₁·p1 + h₁₁·m1 in the power
2
+ // form relative to p0, with Δ = p1 − p0:
3
+ //
4
+ // H(u) − p0 = u · (m0 + u · (c2 + u · c3)),
5
+ // c2 = 3Δ − 2·m0 − m1 = 2·(Δ − m0) + (Δ − m1),
6
+ // c3 = m0 + m1 − 2Δ = (m0 − Δ) + (m1 − Δ).
7
+ //
8
+ // Writing the coefficients through the differences Δ − m keeps the two cases a
9
+ // sampler must reproduce bit for bit: equal points with zero tangents (a flat
10
+ // run) give c2 = c3 = 0 and H = p0, and tangents equal to Δ (a straight span)
11
+ // give H = p0 + u·Δ, monotone in u. Nothing is larger than the points'
12
+ // differences, so far-off coordinates keep their digits.
13
+ //
14
+ // Writes the points at u = 1/samples, …, (samples − 1)/samples, then p1
15
+ // itself; returns the offset after the last number written. No check.
16
+ export function cubicHermite2Samples_(out, offset, samples, x0, y0, tangentX0, tangentY0, x1, y1, tangentX1, tangentY1) {
17
+ const startX = x1 - x0 - tangentX0;
18
+ const startY = y1 - y0 - tangentY0;
19
+ const endX = x1 - x0 - tangentX1;
20
+ const endY = y1 - y0 - tangentY1;
21
+ const squareX = 2 * startX + endX;
22
+ const squareY = 2 * startY + endY;
23
+ const cubeX = -startX - endX;
24
+ const cubeY = -startY - endY;
25
+ for (let index = 1; index < samples; index++) {
26
+ const u = index / samples;
27
+ out[offset++] = x0 + u * (tangentX0 + u * (squareX + u * cubeX));
28
+ out[offset++] = y0 + u * (tangentY0 + u * (squareY + u * cubeY));
29
+ }
30
+ out[offset++] = x1;
31
+ out[offset++] = y1;
32
+ return offset;
33
+ }
34
+ //# sourceMappingURL=_hermite2-samples.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"_hermite2-samples.js","sourceRoot":"","sources":["../src/_hermite2-samples.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,yCAAyC;AACzC,EAAE;AACF,8CAA8C;AAC9C,iDAAiD;AACjD,+CAA+C;AAC/C,EAAE;AACF,+EAA+E;AAC/E,8EAA8E;AAC9E,8EAA8E;AAC9E,uEAAuE;AACvE,yDAAyD;AACzD,EAAE;AACF,wEAAwE;AACxE,sEAAsE;AACtE,MAAM,UAAU,qBAAqB,CACpC,GAAiB,EACjB,MAAc,EACd,OAAe,EACf,EAAU,EACV,EAAU,EACV,SAAiB,EACjB,SAAiB,EACjB,EAAU,EACV,EAAU,EACV,SAAiB,EACjB,SAAiB;IAEjB,MAAM,MAAM,GAAG,EAAE,GAAG,EAAE,GAAG,SAAS,CAAC;IACnC,MAAM,MAAM,GAAG,EAAE,GAAG,EAAE,GAAG,SAAS,CAAC;IACnC,MAAM,IAAI,GAAG,EAAE,GAAG,EAAE,GAAG,SAAS,CAAC;IACjC,MAAM,IAAI,GAAG,EAAE,GAAG,EAAE,GAAG,SAAS,CAAC;IACjC,MAAM,OAAO,GAAG,CAAC,GAAG,MAAM,GAAG,IAAI,CAAC;IAClC,MAAM,OAAO,GAAG,CAAC,GAAG,MAAM,GAAG,IAAI,CAAC;IAClC,MAAM,KAAK,GAAG,CAAC,MAAM,GAAG,IAAI,CAAC;IAC7B,MAAM,KAAK,GAAG,CAAC,MAAM,GAAG,IAAI,CAAC;IAE7B,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,OAAO,EAAE,KAAK,EAAE,EAAE,CAAC;QAC9C,MAAM,CAAC,GAAG,KAAK,GAAG,OAAO,CAAC;QAE1B,GAAG,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,CAAC,SAAS,GAAG,CAAC,GAAG,CAAC,OAAO,GAAG,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC;QACjE,GAAG,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,CAAC,SAAS,GAAG,CAAC,GAAG,CAAC,OAAO,GAAG,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC;IAClE,CAAC;IAED,GAAG,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC;IACnB,GAAG,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC;IAEnB,OAAO,MAAM,CAAC;AACf,CAAC"}
@@ -0,0 +1,103 @@
1
+ import { type ReadonlyVec2 } from "@ac-kit/math-linear";
2
+ /**
3
+ * An upper bound on the number of vertices {@link quadraticBezier2Flatten}
4
+ * writes for these points and tolerance, to size `out` with (`2 × count`
5
+ * numbers): the uniform-step count of Wang's formula, `⌈√(|p0 − 2·p1 + p2| / (4
6
+ * · tolerance))⌉`, which the adaptive flattening never exceeds. At least 1;
7
+ * coincident or collinear-and-evenly-spaced control points give 1, and so do
8
+ * NaN or infinite points and a tolerance that is zero, negative or NaN.
9
+ *
10
+ * The count is computed from the differences scaled by their largest, with
11
+ * square roots taken before the ratio is formed, so a uniformly tiny or huge
12
+ * curve keeps its count. The range of the arithmetic is that of lengths (S12):
13
+ * results are guaranteed while the differences between the points and the
14
+ * tolerance lie within about [1e−150, 1e150]; beyond, a bend much smaller than
15
+ * the curve's extent can be lost.
16
+ *
17
+ * Complexity: O(1).
18
+ *
19
+ * @param p0 - Start point.
20
+ * @param p1 - Control point.
21
+ * @param p2 - End point.
22
+ * @param tolerance - Maximum distance, in the points' units; `Infinity` gives 1.
23
+ * @returns The vertex bound `n ≥ 1`.
24
+ */
25
+ export declare function quadraticBezier2FlattenCount(p0: ReadonlyVec2, p1: ReadonlyVec2, p2: ReadonlyVec2, tolerance: number): number;
26
+ /**
27
+ * An upper bound on the number of vertices {@link cubicBezier2Flatten} writes
28
+ * for these points and tolerance, to size `out` with (`2 × count` numbers): the
29
+ * uniform-step count of Wang's formula, `⌈√(3 · max(|p0 − 2·p1 + p2|, |p1 −
30
+ * 2·p2 + p3|) / (4 · tolerance))⌉`, or one more when the curve's third
31
+ * difference needs it. At least 1, and 1 for coincident points, NaN or infinite
32
+ * points and a bad tolerance. Same range as
33
+ * {@link quadraticBezier2FlattenCount}.
34
+ *
35
+ * Complexity: O(1).
36
+ *
37
+ * @param p0 - Start point.
38
+ * @param p1 - First control point.
39
+ * @param p2 - Second control point.
40
+ * @param p3 - End point.
41
+ * @param tolerance - Maximum distance, in the points' units; `Infinity` gives 1.
42
+ * @returns The vertex bound `n ≥ 1`.
43
+ */
44
+ export declare function cubicBezier2FlattenCount(p0: ReadonlyVec2, p1: ReadonlyVec2, p2: ReadonlyVec2, p3: ReadonlyVec2, tolerance: number): number;
45
+ /**
46
+ * Flattens a quadratic Bézier into a polyline: writes the vertices after `p0`
47
+ * (which the caller already holds as the previous vertex), the last one being
48
+ * exactly `p2`, so consecutive segments of a path chain without a duplicate.
49
+ *
50
+ * Tolerance is a maximum distance: every point of the curve lies within
51
+ * `tolerance` of the polyline `p0`, vertices…, and every vertex lies on the
52
+ * curve. The flattening is adaptive: each chord is about as long as the
53
+ * tolerance allows where it lies, so a curve whose bend is concentrated in a
54
+ * short stretch gets few vertices on its flat part. The count is at most
55
+ * {@link quadraticBezier2FlattenCount}, which is what `out` must hold. A
56
+ * degenerate curve (coincident points) gives the single vertex `p2`; NaN or
57
+ * infinite points (or differences between them beyond `Number.MAX_VALUE`) and a
58
+ * tolerance that is zero, negative or NaN give the single vertex (NaN, NaN)
59
+ * (S13). Coordinates far from the origin keep their digits: vertices are
60
+ * evaluated relative to `p0`. The written coordinates are rounded, so the
61
+ * guarantee holds up to that rounding: a tolerance must exceed the ulp of the
62
+ * coordinates (2 at 1e16) to be met. Range as for
63
+ * {@link quadraticBezier2FlattenCount}.
64
+ *
65
+ * Complexity: O(n) time for the n vertices written, no allocation.
66
+ *
67
+ * @param out - Destination, 2 numbers (x, y) per vertex.
68
+ * @param offset - Index in `out` of the first number written.
69
+ * @param p0 - Start point (not written).
70
+ * @param p1 - Control point.
71
+ * @param p2 - End point.
72
+ * @param tolerance - Maximum distance in the points' units.
73
+ * @returns The vertex count written (`n`, so `2 · n` numbers).
74
+ * @throws {RangeError} When `offset` is not a non-negative integer, or `out`
75
+ * has fewer than `offset + 2 · quadraticBezier2FlattenCount(…)` numbers;
76
+ * nothing is written then.
77
+ */
78
+ export declare function quadraticBezier2Flatten(out: Float64Array, offset: number, p0: ReadonlyVec2, p1: ReadonlyVec2, p2: ReadonlyVec2, tolerance: number): number;
79
+ /**
80
+ * Flattens a cubic Bézier into a polyline: writes the vertices after `p0`, the
81
+ * last one being exactly `p3`. Same contract as {@link quadraticBezier2Flatten}:
82
+ * `tolerance` is a maximum distance between the curve and the polyline,
83
+ * vertices lie on the curve, chords follow the curvature, the count is at most
84
+ * {@link cubicBezier2FlattenCount}, a degenerate curve gives the single vertex
85
+ * `p3`, non-finite points or a bad tolerance the single vertex (NaN, NaN), and
86
+ * the guarantee holds up to the rounding of the written coordinates.
87
+ *
88
+ * Complexity: O(n) time for the n vertices written, no allocation.
89
+ *
90
+ * @param out - Destination, 2 numbers (x, y) per vertex.
91
+ * @param offset - Index in `out` of the first number written.
92
+ * @param p0 - Start point (not written).
93
+ * @param p1 - First control point.
94
+ * @param p2 - Second control point.
95
+ * @param p3 - End point.
96
+ * @param tolerance - Maximum distance in the points' units.
97
+ * @returns The vertex count written (`n`, so `2 · n` numbers).
98
+ * @throws {RangeError} When `offset` is not a non-negative integer, or `out`
99
+ * has fewer than `offset + 2 · cubicBezier2FlattenCount(…)` numbers; nothing
100
+ * is written then.
101
+ */
102
+ export declare function cubicBezier2Flatten(out: Float64Array, offset: number, p0: ReadonlyVec2, p1: ReadonlyVec2, p2: ReadonlyVec2, p3: ReadonlyVec2, tolerance: number): number;
103
+ //# sourceMappingURL=bezier2-flatten.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bezier2-flatten.d.ts","sourceRoot":"","sources":["../src/bezier2-flatten.ts"],"names":[],"mappings":"AACA,OAAO,EACN,KAAK,YAAY,EAGjB,MAAM,qBAAqB,CAAC;AAuW7B;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,4BAA4B,CAC3C,EAAE,EAAE,YAAY,EAChB,EAAE,EAAE,YAAY,EAChB,EAAE,EAAE,YAAY,EAChB,SAAS,EAAE,MAAM,GACf,MAAM,CAER;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,wBAAwB,CACvC,EAAE,EAAE,YAAY,EAChB,EAAE,EAAE,YAAY,EAChB,EAAE,EAAE,YAAY,EAChB,EAAE,EAAE,YAAY,EAChB,SAAS,EAAE,MAAM,GACf,MAAM,CAER;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,wBAAgB,uBAAuB,CACtC,GAAG,EAAE,YAAY,EACjB,MAAM,EAAE,MAAM,EACd,EAAE,EAAE,YAAY,EAChB,EAAE,EAAE,YAAY,EAChB,EAAE,EAAE,YAAY,EAChB,SAAS,EAAE,MAAM,GACf,MAAM,CAuCR;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,mBAAmB,CAClC,GAAG,EAAE,YAAY,EACjB,MAAM,EAAE,MAAM,EACd,EAAE,EAAE,YAAY,EAChB,EAAE,EAAE,YAAY,EAChB,EAAE,EAAE,YAAY,EAChB,EAAE,EAAE,YAAY,EAChB,SAAS,EAAE,MAAM,GACf,MAAM,CA2CR"}