curvy 2.0.0-alpha.14 → 2.0.0-alpha.15
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/dist/curve/cubic2d.d.ts +0 -10
- package/dist/curve/index.mjs +1 -1
- package/dist/curve/linear2d.d.ts +0 -9
- package/dist/curve/quadratic2d.d.ts +0 -11
- package/dist/path/index.mjs +2 -2
- package/dist/path/index.mjs.map +1 -1
- package/dist/shared/{rationalCubic2d-bveuGqBZ.mjs → rationalCubic2d-CZiP8nIq.mjs} +2 -2
- package/dist/shared/rationalCubic2d-CZiP8nIq.mjs.map +1 -0
- package/dist/shared/{rationalCubic2d-CZSwwKtS.mjs → rationalCubic2d-gM7VeiiT.mjs} +68 -74
- package/dist/shared/rationalCubic2d-gM7VeiiT.mjs.map +1 -0
- package/dist/splines/index.mjs +2 -2
- package/package.json +1 -1
- package/dist/shared/rationalCubic2d-CZSwwKtS.mjs.map +0 -1
- package/dist/shared/rationalCubic2d-bveuGqBZ.mjs.map +0 -1
package/dist/curve/cubic2d.d.ts
CHANGED
|
@@ -8,7 +8,6 @@ import type * as Solution from '../solution/solution.ts';
|
|
|
8
8
|
import type { Affine2d } from '../transform/affine2d.ts';
|
|
9
9
|
import type { Vector2 } from '../vector/vector2.ts';
|
|
10
10
|
import type { CubicCurve2dTypeId } from './cubic2d.internal.ts';
|
|
11
|
-
import type { Curve2dOps } from './curve2d.ts';
|
|
12
11
|
export type { Monotonic, Increasing, Decreasing } from '../polynomial/traits.ts';
|
|
13
12
|
/**
|
|
14
13
|
* A cubic curve in 2D space.
|
|
@@ -303,12 +302,3 @@ export declare const transform: {
|
|
|
303
302
|
*/
|
|
304
303
|
(a: Affine2d): (c: CubicCurve2d) => CubicCurve2d;
|
|
305
304
|
};
|
|
306
|
-
/**
|
|
307
|
-
* The {@link Curve2dOps} bundle for `CubicCurve2d`. Used by `CubicPath2d`
|
|
308
|
-
* to wire up the path-level operation surface. The `solveAtX` / `solveAtY`
|
|
309
|
-
* entries narrow the curve's potentially-3-element result to `AtMostOne` —
|
|
310
|
-
* path callers enforce that via the path's `MonotonicX`/`MonotonicY` brand.
|
|
311
|
-
*
|
|
312
|
-
* @since 2.0.0
|
|
313
|
-
*/
|
|
314
|
-
export declare const Ops: Curve2dOps<CubicCurve2d>;
|
package/dist/curve/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { i as rationalCubic2d_exports, m as quadratic2d_exports, s as cubic2d_exports, v as linear2d_exports } from "../shared/rationalCubic2d-gM7VeiiT.mjs";
|
|
2
2
|
export { cubic2d_exports as CubicCurve2d, linear2d_exports as LinearCurve2d, quadratic2d_exports as QuadraticCurve2d, rationalCubic2d_exports as RationalCubicCurve2d };
|
package/dist/curve/linear2d.d.ts
CHANGED
|
@@ -7,7 +7,6 @@ import type { Decreasing, Increasing, Monotonic } from '../polynomial/traits.ts'
|
|
|
7
7
|
import type * as Solution from '../solution/solution.ts';
|
|
8
8
|
import type { Affine2d } from '../transform/affine2d.ts';
|
|
9
9
|
import type { Vector2 } from '../vector/vector2.ts';
|
|
10
|
-
import type { Curve2dOps } from './curve2d.ts';
|
|
11
10
|
import type { LinearCurve2dTypeId } from './linear2d.internal.ts';
|
|
12
11
|
export type { Monotonic, Increasing, Decreasing } from '../polynomial/traits.ts';
|
|
13
12
|
/**
|
|
@@ -304,11 +303,3 @@ export declare const transform: {
|
|
|
304
303
|
*/
|
|
305
304
|
(a: Affine2d): (c: LinearCurve2d) => LinearCurve2d;
|
|
306
305
|
};
|
|
307
|
-
/**
|
|
308
|
-
* The {@link Curve2dOps} bundle for `LinearCurve2d`. Used by
|
|
309
|
-
* `LinearPath2d` (and any user code building a generic `Path2d` over linear
|
|
310
|
-
* curves) to wire up the path-level operation surface.
|
|
311
|
-
*
|
|
312
|
-
* @since 2.0.0
|
|
313
|
-
*/
|
|
314
|
-
export declare const Ops: Curve2dOps<LinearCurve2d>;
|
|
@@ -7,7 +7,6 @@ import type { Decreasing, Increasing, Monotonic } from '../polynomial/traits.ts'
|
|
|
7
7
|
import type * as Solution from '../solution/solution.ts';
|
|
8
8
|
import type { Affine2d } from '../transform/affine2d.ts';
|
|
9
9
|
import type { Vector2 } from '../vector/vector2.ts';
|
|
10
|
-
import type { Curve2dOps } from './curve2d.ts';
|
|
11
10
|
import type { LinearCurve2d } from './linear2d.ts';
|
|
12
11
|
import type { QuadraticCurve2dTypeId } from './quadratic2d.internal.ts';
|
|
13
12
|
export type { Monotonic, Increasing, Decreasing } from '../polynomial/traits.ts';
|
|
@@ -311,13 +310,3 @@ export declare const transform: {
|
|
|
311
310
|
*/
|
|
312
311
|
(a: Affine2d): (c: QuadraticCurve2d) => QuadraticCurve2d;
|
|
313
312
|
};
|
|
314
|
-
/**
|
|
315
|
-
* The {@link Curve2dOps} bundle for `QuadraticCurve2d`. Used by
|
|
316
|
-
* `QuadraticPath2d` to wire up the path-level operation surface. The
|
|
317
|
-
* `solveAtX` / `solveAtY` entries narrow the curve's potentially-2-element
|
|
318
|
-
* result to `AtMostOne` — path callers enforce that via the path's
|
|
319
|
-
* `MonotonicX`/`MonotonicY` brand.
|
|
320
|
-
*
|
|
321
|
-
* @since 2.0.0
|
|
322
|
-
*/
|
|
323
|
-
export declare const Ops: Curve2dOps<QuadraticCurve2d>;
|
package/dist/path/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as __exportAll } from "../shared/chunk-25Hzd3z8.mjs";
|
|
2
2
|
import { invariant } from "../utils.mjs";
|
|
3
|
-
import {
|
|
4
|
-
import { n as rationalCubic2d_exports, o as linear2d_exports, r as cubic2d_exports, s as makeMethods } from "../shared/rationalCubic2d-
|
|
3
|
+
import { g as Ops } from "../shared/rationalCubic2d-gM7VeiiT.mjs";
|
|
4
|
+
import { n as rationalCubic2d_exports, o as linear2d_exports, r as cubic2d_exports, s as makeMethods } from "../shared/rationalCubic2d-CZiP8nIq.mjs";
|
|
5
5
|
//#region src/path/quadratic2d.internal.ts
|
|
6
6
|
const QuadraticPath2dTypeId = Symbol("curvy/path/quadratic2d");
|
|
7
7
|
const methods = makeMethods(QuadraticPath2dTypeId, Ops);
|
package/dist/path/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["Path2d.makeMethods","QuadraticCurve2d.Ops","isQuadraticPath2d","make","fromArray","append","length","solve","toPathData","isContinuous","asContinuous","isIncreasingX","isDecreasingX","isMonotonicX","isIncreasingY","isDecreasingY","isMonotonicY","asIncreasingX","asDecreasingX","asMonotonicX","asIncreasingY","asDecreasingY","asMonotonicY","solveAtX","solveAtY","boundingBox","transform","internal.make","internal.fromArray","internal.isQuadraticPath2d","internal.append","internal.length","internal.solve","internal.toPathData","internal.isContinuous","internal.asContinuous","internal.isIncreasingX","internal.isDecreasingX","internal.isMonotonicX","internal.isIncreasingY","internal.isDecreasingY","internal.isMonotonicY","internal.asIncreasingX","internal.asDecreasingX","internal.asMonotonicX","internal.asIncreasingY","internal.asDecreasingY","internal.asMonotonicY","internal.solveAtX","internal.solveAtY","internal.boundingBox","internal.transform"],"sources":["../../src/path/quadratic2d.internal.ts","../../src/path/quadratic2d.ts"],"sourcesContent":["import * as QuadraticCurve2d from '../curve/quadratic2d.ts'\nimport type { Closed } from '../interval/interval.ts'\nimport type { Interval2d } from '../interval/interval2d.ts'\nimport { invariant } from '../utils.ts'\nimport * as Path2d from './path2d.ts'\nimport type { QuadraticPath2d } from './quadratic2d.ts'\nimport {\n type Continuous,\n type DecreasingX,\n type DecreasingY,\n type IncreasingX,\n type IncreasingY,\n type MonotonicX,\n type MonotonicY,\n} from './traits.ts'\n\nexport const QuadraticPath2dTypeId: unique symbol = Symbol('curvy/path/quadratic2d')\nexport type QuadraticPath2dTypeId = typeof QuadraticPath2dTypeId\n\n// Generic operation surface, built once for QuadraticCurve2d's Ops.\nconst methods = Path2d.makeMethods(QuadraticPath2dTypeId, QuadraticCurve2d.Ops)\n\n/** @internal */\nexport const isQuadraticPath2d = (p: unknown): p is QuadraticPath2d =>\n typeof p === 'object' && p !== null && QuadraticPath2dTypeId in p\n\n/** @internal */\nexport const make = methods.make as (\n ...curves: ReadonlyArray<QuadraticCurve2d.QuadraticCurve2d>\n) => QuadraticPath2d\n\n/** @internal */\nexport const fromArray = methods.fromArray as (\n curves: ReadonlyArray<QuadraticCurve2d.QuadraticCurve2d>,\n) => QuadraticPath2d\n\n/** @internal */\nexport const append = methods.append as never\n\n/** @internal */\nexport const length = methods.length as (p: QuadraticPath2d) => number\n\n/** @internal */\nexport const solve = methods.solve as never\n\n/** @internal */\nexport const toPathData = methods.toPathData as (p: QuadraticPath2d) => string\n\n/** @internal */\nexport const isContinuous = methods.isContinuous as unknown as <T>(\n p: QuadraticPath2d<T>,\n) => p is QuadraticPath2d<T & Continuous>\n\n/** @internal */\nexport const asContinuous = <T>(p: QuadraticPath2d<T>): QuadraticPath2d<T & Continuous> => {\n invariant(isContinuous(p), 'quadratic path is not continuous')\n return p\n}\n\n/** @internal */\nexport const isIncreasingX = methods.isIncreasingX as unknown as <T>(\n p: QuadraticPath2d<T>,\n) => p is QuadraticPath2d<T & IncreasingX>\n\n/** @internal */\nexport const isDecreasingX = methods.isDecreasingX as unknown as <T>(\n p: QuadraticPath2d<T>,\n) => p is QuadraticPath2d<T & DecreasingX>\n\n/** @internal */\nexport const isMonotonicX = methods.isMonotonicX as unknown as <T>(\n p: QuadraticPath2d<T>,\n) => p is QuadraticPath2d<T & MonotonicX>\n\n/** @internal */\nexport const isIncreasingY = methods.isIncreasingY as unknown as <T>(\n p: QuadraticPath2d<T>,\n) => p is QuadraticPath2d<T & IncreasingY>\n\n/** @internal */\nexport const isDecreasingY = methods.isDecreasingY as unknown as <T>(\n p: QuadraticPath2d<T>,\n) => p is QuadraticPath2d<T & DecreasingY>\n\n/** @internal */\nexport const isMonotonicY = methods.isMonotonicY as unknown as <T>(\n p: QuadraticPath2d<T>,\n) => p is QuadraticPath2d<T & MonotonicY>\n\n/** @internal */\nexport const asIncreasingX = <T>(p: QuadraticPath2d<T>): QuadraticPath2d<T & IncreasingX> => {\n invariant(isIncreasingX(p), 'quadratic path is not increasing in x')\n return p\n}\n\n/** @internal */\nexport const asDecreasingX = <T>(p: QuadraticPath2d<T>): QuadraticPath2d<T & DecreasingX> => {\n invariant(isDecreasingX(p), 'quadratic path is not decreasing in x')\n return p\n}\n\n/** @internal */\nexport const asMonotonicX = <T>(p: QuadraticPath2d<T>): QuadraticPath2d<T & MonotonicX> => {\n invariant(isMonotonicX(p), 'quadratic path is not monotonic in x')\n return p\n}\n\n/** @internal */\nexport const asIncreasingY = <T>(p: QuadraticPath2d<T>): QuadraticPath2d<T & IncreasingY> => {\n invariant(isIncreasingY(p), 'quadratic path is not increasing in y')\n return p\n}\n\n/** @internal */\nexport const asDecreasingY = <T>(p: QuadraticPath2d<T>): QuadraticPath2d<T & DecreasingY> => {\n invariant(isDecreasingY(p), 'quadratic path is not decreasing in y')\n return p\n}\n\n/** @internal */\nexport const asMonotonicY = <T>(p: QuadraticPath2d<T>): QuadraticPath2d<T & MonotonicY> => {\n invariant(isMonotonicY(p), 'quadratic path is not monotonic in y')\n return p\n}\n\n/** @internal */\nexport const solveAtX = methods.solveAtX as never\n\n/** @internal */\nexport const solveAtY = methods.solveAtY as never\n\n/** @internal */\nexport const boundingBox = methods.boundingBox as (p: QuadraticPath2d) => Interval2d<Closed, Closed>\n\n/** @internal */\nexport const transform = methods.transform as never\n","import type { Interval2d } from '../interval/interval2d.ts'\nimport type { QuadraticCurve2d } from '../curve/quadratic2d.ts'\nimport type { Closed } from '../interval/interval.ts'\nimport type * as Solution from '../solution/solution.ts'\nimport type { Affine2d } from '../transform/affine2d.ts'\nimport type { Pipeable } from '../utils.ts'\nimport type { Vector2 } from '../vector/vector2.ts'\nimport type { QuadraticPath2dTypeId } from './quadratic2d.internal.ts'\nimport * as internal from './quadratic2d.internal.ts'\nimport type {\n Continuous,\n DecreasingX,\n DecreasingY,\n IncreasingX,\n IncreasingY,\n MonotonicX,\n MonotonicY,\n PathTraits,\n} from './traits.ts'\n\nexport type {\n Continuous,\n DecreasingX,\n DecreasingY,\n IncreasingX,\n IncreasingY,\n MonotonicX,\n MonotonicY,\n} from './traits.ts'\n\n/**\n * A quadratic path in 2D space.\n *\n * All fields are readonly and immutable, and all operations create new instances.\n *\n * The `Trait` type parameter accumulates trait brands as the path is refined\n * via `isContinuous` / `asContinuous`.\n *\n * @since 1.0.0\n */\nexport interface QuadraticPath2d<out Trait = unknown> extends Pipeable, Iterable<QuadraticCurve2d> {\n readonly [QuadraticPath2dTypeId]: QuadraticPath2dTypeId\n readonly [PathTraits]: Trait\n}\n\n/**\n * Creates a new `QuadraticPath2d` instance from a sequence of curves.\n *\n * @param curves - The curves to create the path from.\n * @returns A new `QuadraticPath2d` instance.\n * @since 2.0.0\n */\nexport const make: (...curves: ReadonlyArray<QuadraticCurve2d>) => QuadraticPath2d = internal.make\n\n/**\n * Creates a new `QuadraticPath2d` instance from an array of curves.\n *\n * @param curves - The curves to create the path from.\n * @returns A new `QuadraticPath2d` instance.\n * @since 2.0.0\n */\nexport const fromArray: (curves: ReadonlyArray<QuadraticCurve2d>) => QuadraticPath2d =\n internal.fromArray\n\n/**\n * Checks if a value is a `QuadraticPath2d`.\n *\n * @param p - The value to check.\n * @returns `true` if the value is a `QuadraticPath2d`, `false` otherwise.\n * @since 1.0.0\n */\nexport const isQuadraticPath2d: (p: unknown) => p is QuadraticPath2d = internal.isQuadraticPath2d\n\nexport const append: {\n /**\n * Appends a quadratic curve to a quadratic path.\n *\n * @param c - The quadratic curve to append.\n * @returns A function that takes a quadratic path and returns a new quadratic path.\n * @since 1.0.0\n */\n (c: QuadraticCurve2d): (p: QuadraticPath2d) => QuadraticPath2d\n /**\n * Appends a quadratic curve to a quadratic path.\n *\n * @param p - The quadratic path to append to.\n * @param c - The quadratic curve to append.\n * @returns A new `QuadraticPath2d` instance with the appended curve.\n * @since 1.0.0\n */\n (p: QuadraticPath2d, c: QuadraticCurve2d): QuadraticPath2d\n} = internal.append\n\n/**\n * Calculates the length of a quadratic path.\n *\n * @param p - The quadratic path to calculate the length of.\n * @returns The length of the path.\n */\nexport const length: (p: QuadraticPath2d) => number = internal.length\n\nexport const solve: {\n /**\n * Solves a quadratic path at a given parameter.\n *\n * @param u - The parameter to solve for.\n * @returns A function that takes a quadratic path and returns the solved point.\n * @since 1.0.0\n */\n (u: number): (p: QuadraticPath2d) => Vector2\n /**\n * Solves a quadratic path at a given parameter.\n *\n * @param p - The quadratic path to solve.\n * @param u - The parameter to solve for.\n * @returns The solved point.\n * @since 1.0.0\n */\n (p: QuadraticPath2d, u: number): Vector2\n} = internal.solve\n\n/**\n * Serializes a quadratic path as an SVG path data string (the value of a\n * `<path>` element's `d` attribute), using `M` and `Q` commands. Discontinuities\n * between curves emit a fresh `M` command.\n *\n * @param p - The quadratic path to serialize.\n * @returns The SVG path data string.\n * @since 2.0.0\n */\nexport const toPathData: (p: QuadraticPath2d) => string = internal.toPathData\n\n/**\n * Type-narrowing predicate: refines `QuadraticPath2d<T>` to\n * `QuadraticPath2d<T & Continuous>` when adjacent curves connect.\n *\n * @since 2.0.0\n */\nexport const isContinuous: <T>(p: QuadraticPath2d<T>) => p is QuadraticPath2d<T & Continuous> =\n internal.isContinuous\n\n/**\n * Asserts that the quadratic path is continuous, throwing on failure.\n *\n * @since 2.0.0\n */\nexport const asContinuous: <T>(p: QuadraticPath2d<T>) => QuadraticPath2d<T & Continuous> =\n internal.asContinuous\n\n/**\n * Type-narrowing predicate: refines `QuadraticPath2d<T>` to\n * `QuadraticPath2d<T & IncreasingX>` when every segment's x-polynomial is\n * strictly increasing on `[0, 1]` and adjacent segments' x-ranges don't\n * overlap.\n *\n * @since 2.0.0\n */\nexport const isIncreasingX: <T>(p: QuadraticPath2d<T>) => p is QuadraticPath2d<T & IncreasingX> =\n internal.isIncreasingX\n\n/**\n * Type-narrowing predicate: refines `QuadraticPath2d<T>` to\n * `QuadraticPath2d<T & DecreasingX>`.\n *\n * @since 2.0.0\n */\nexport const isDecreasingX: <T>(p: QuadraticPath2d<T>) => p is QuadraticPath2d<T & DecreasingX> =\n internal.isDecreasingX\n\n/**\n * Type-narrowing predicate: refines `QuadraticPath2d<T>` to\n * `QuadraticPath2d<T & MonotonicX>`.\n *\n * @since 2.0.0\n */\nexport const isMonotonicX: <T>(p: QuadraticPath2d<T>) => p is QuadraticPath2d<T & MonotonicX> =\n internal.isMonotonicX\n\n/**\n * Type-narrowing predicate: refines `QuadraticPath2d<T>` to\n * `QuadraticPath2d<T & IncreasingY>`.\n *\n * @since 2.0.0\n */\nexport const isIncreasingY: <T>(p: QuadraticPath2d<T>) => p is QuadraticPath2d<T & IncreasingY> =\n internal.isIncreasingY\n\n/**\n * Type-narrowing predicate: refines `QuadraticPath2d<T>` to\n * `QuadraticPath2d<T & DecreasingY>`.\n *\n * @since 2.0.0\n */\nexport const isDecreasingY: <T>(p: QuadraticPath2d<T>) => p is QuadraticPath2d<T & DecreasingY> =\n internal.isDecreasingY\n\n/**\n * Type-narrowing predicate: refines `QuadraticPath2d<T>` to\n * `QuadraticPath2d<T & MonotonicY>`.\n *\n * @since 2.0.0\n */\nexport const isMonotonicY: <T>(p: QuadraticPath2d<T>) => p is QuadraticPath2d<T & MonotonicY> =\n internal.isMonotonicY\n\n/**\n * Asserts that the path is strictly increasing in x, throwing on failure.\n *\n * @since 2.0.0\n */\nexport const asIncreasingX: <T>(p: QuadraticPath2d<T>) => QuadraticPath2d<T & IncreasingX> =\n internal.asIncreasingX\n\n/**\n * Asserts that the path is strictly decreasing in x, throwing on failure.\n *\n * @since 2.0.0\n */\nexport const asDecreasingX: <T>(p: QuadraticPath2d<T>) => QuadraticPath2d<T & DecreasingX> =\n internal.asDecreasingX\n\n/**\n * Asserts that the path is monotonic in x, throwing on failure.\n *\n * @since 2.0.0\n */\nexport const asMonotonicX: <T>(p: QuadraticPath2d<T>) => QuadraticPath2d<T & MonotonicX> =\n internal.asMonotonicX\n\n/**\n * Asserts that the path is strictly increasing in y, throwing on failure.\n *\n * @since 2.0.0\n */\nexport const asIncreasingY: <T>(p: QuadraticPath2d<T>) => QuadraticPath2d<T & IncreasingY> =\n internal.asIncreasingY\n\n/**\n * Asserts that the path is strictly decreasing in y, throwing on failure.\n *\n * @since 2.0.0\n */\nexport const asDecreasingY: <T>(p: QuadraticPath2d<T>) => QuadraticPath2d<T & DecreasingY> =\n internal.asDecreasingY\n\n/**\n * Asserts that the path is monotonic in y, throwing on failure.\n *\n * @since 2.0.0\n */\nexport const asMonotonicY: <T>(p: QuadraticPath2d<T>) => QuadraticPath2d<T & MonotonicY> =\n internal.asMonotonicY\n\nexport const solveAtX: {\n /**\n * Evaluates the path's y value at a given x. Requires the path to carry\n * the `MonotonicX` brand. Returns `Solution.none` when x is outside the\n * path's x-range.\n *\n * @param p - A path branded `MonotonicX`.\n * @param x - The x coordinate.\n * @returns The y value at x, or `none` when x is outside the path's range.\n * @since 2.0.0\n */\n <T extends MonotonicX>(p: QuadraticPath2d<T>, x: number): Solution.AtMostOne<number>\n /** @since 2.0.0 */\n (x: number): <T extends MonotonicX>(p: QuadraticPath2d<T>) => Solution.AtMostOne<number>\n} = internal.solveAtX as never\n\nexport const solveAtY: {\n /**\n * Evaluates the path's x value at a given y. Requires the path to carry\n * the `MonotonicY` brand. Returns `Solution.none` when y is outside the\n * path's y-range.\n *\n * @param p - A path branded `MonotonicY`.\n * @param y - The y coordinate.\n * @returns The x value at y, or `none` when y is outside the path's range.\n * @since 2.0.0\n */\n <T extends MonotonicY>(p: QuadraticPath2d<T>, y: number): Solution.AtMostOne<number>\n /** @since 2.0.0 */\n (y: number): <T extends MonotonicY>(p: QuadraticPath2d<T>) => Solution.AtMostOne<number>\n} = internal.solveAtY as never\n\n/**\n * Computes the axis-aligned bounding box of the path — the smallest closed\n * `Box2d` enclosing every segment.\n *\n * @param p - The quadratic path.\n * @returns A closed `Box2d` enclosing the path.\n * @since 2.0.0\n */\nexport const boundingBox: (p: QuadraticPath2d) => Interval2d<Closed, Closed> = internal.boundingBox\n\nexport const transform: {\n /**\n * Applies an `Affine2d` transform to every curve in a `QuadraticPath2d`,\n * returning a new path whose image is the affine image of the original.\n * Trait brands are dropped.\n *\n * @param p - The quadratic path.\n * @param a - The affine transform.\n * @returns A new unbranded `QuadraticPath2d` whose curves are the affine images of the input's.\n * @since 2.0.0\n */\n (p: QuadraticPath2d, a: Affine2d): QuadraticPath2d\n /**\n * Applies an `Affine2d` transform to every curve in a `QuadraticPath2d`.\n *\n * @param a - The affine transform.\n * @returns A function that takes a `QuadraticPath2d` and returns the transformed path.\n * @since 2.0.0\n */\n (a: Affine2d): (p: QuadraticPath2d) => QuadraticPath2d\n} = internal.transform\n"],"mappings":";;;;;AAgBA,MAAa,wBAAuC,OAAO,yBAAyB;AAIpF,MAAM,UAAUA,YAAmB,uBAAuBC,IAAqB;;AAG/E,MAAaC,uBAAqB,MAChC,OAAO,MAAM,YAAY,MAAM,QAAQ,yBAAyB;;AAGlE,MAAaC,SAAO,QAAQ;;AAK5B,MAAaC,cAAY,QAAQ;;AAKjC,MAAaC,WAAS,QAAQ;;AAG9B,MAAaC,WAAS,QAAQ;;AAG9B,MAAaC,UAAQ,QAAQ;;AAG7B,MAAaC,eAAa,QAAQ;;AAGlC,MAAaC,iBAAe,QAAQ;;AAKpC,MAAaC,kBAAmB,MAA2D;CACzF,UAAUD,eAAa,EAAE,EAAE,mCAAmC;CAC9D,OAAO;;;AAIT,MAAaE,kBAAgB,QAAQ;;AAKrC,MAAaC,kBAAgB,QAAQ;;AAKrC,MAAaC,iBAAe,QAAQ;;AAKpC,MAAaC,kBAAgB,QAAQ;;AAKrC,MAAaC,kBAAgB,QAAQ;;AAKrC,MAAaC,iBAAe,QAAQ;;AAKpC,MAAaC,mBAAoB,MAA4D;CAC3F,UAAUN,gBAAc,EAAE,EAAE,wCAAwC;CACpE,OAAO;;;AAIT,MAAaO,mBAAoB,MAA4D;CAC3F,U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ticCurveInternal.Ops","isQuadraticPath2d","make","fromArray","append","length","solve","toPathData","isContinuous","asContinuous","isIncreasingX","isDecreasingX","isMonotonicX","isIncreasingY","isDecreasingY","isMonotonicY","asIncreasingX","asDecreasingX","asMonotonicX","asIncreasingY","asDecreasingY","asMonotonicY","solveAtX","solveAtY","boundingBox","transform","internal.make","internal.fromArray","internal.isQuadraticPath2d","internal.append","internal.length","internal.solve","internal.toPathData","internal.isContinuous","internal.asContinuous","internal.isIncreasingX","internal.isDecreasingX","internal.isMonotonicX","internal.isIncreasingY","internal.isDecreasingY","internal.isMonotonicY","internal.asIncreasingX","internal.asDecreasingX","internal.asMonotonicX","internal.asIncreasingY","internal.asDecreasingY","internal.asMonotonicY","internal.solveAtX","internal.solveAtY","internal.boundingBox","internal.transform"],"sources":["../../src/path/quadratic2d.internal.ts","../../src/path/quadratic2d.ts"],"sourcesContent":["import type * as QuadraticCurve2d from '../curve/quadratic2d.ts'\nimport * as quadraticCurveInternal from '../curve/quadratic2d.internal.ts'\nimport type { Closed } from '../interval/interval.ts'\nimport type { Interval2d } from '../interval/interval2d.ts'\nimport { invariant } from '../utils.ts'\nimport * as Path2d from './path2d.ts'\nimport type { QuadraticPath2d } from './quadratic2d.ts'\nimport {\n type Continuous,\n type DecreasingX,\n type DecreasingY,\n type IncreasingX,\n type IncreasingY,\n type MonotonicX,\n type MonotonicY,\n} from './traits.ts'\n\nexport const QuadraticPath2dTypeId: unique symbol = Symbol('curvy/path/quadratic2d')\nexport type QuadraticPath2dTypeId = typeof QuadraticPath2dTypeId\n\n// Generic operation surface, built once for QuadraticCurve2d's Ops.\nconst methods = Path2d.makeMethods(QuadraticPath2dTypeId, quadraticCurveInternal.Ops)\n\n/** @internal */\nexport const isQuadraticPath2d = (p: unknown): p is QuadraticPath2d =>\n typeof p === 'object' && p !== null && QuadraticPath2dTypeId in p\n\n/** @internal */\nexport const make = methods.make as (\n ...curves: ReadonlyArray<QuadraticCurve2d.QuadraticCurve2d>\n) => QuadraticPath2d\n\n/** @internal */\nexport const fromArray = methods.fromArray as (\n curves: ReadonlyArray<QuadraticCurve2d.QuadraticCurve2d>,\n) => QuadraticPath2d\n\n/** @internal */\nexport const append = methods.append as never\n\n/** @internal */\nexport const length = methods.length as (p: QuadraticPath2d) => number\n\n/** @internal */\nexport const solve = methods.solve as never\n\n/** @internal */\nexport const toPathData = methods.toPathData as (p: QuadraticPath2d) => string\n\n/** @internal */\nexport const isContinuous = methods.isContinuous as unknown as <T>(\n p: QuadraticPath2d<T>,\n) => p is QuadraticPath2d<T & Continuous>\n\n/** @internal */\nexport const asContinuous = <T>(p: QuadraticPath2d<T>): QuadraticPath2d<T & Continuous> => {\n invariant(isContinuous(p), 'quadratic path is not continuous')\n return p\n}\n\n/** @internal */\nexport const isIncreasingX = methods.isIncreasingX as unknown as <T>(\n p: QuadraticPath2d<T>,\n) => p is QuadraticPath2d<T & IncreasingX>\n\n/** @internal */\nexport const isDecreasingX = methods.isDecreasingX as unknown as <T>(\n p: QuadraticPath2d<T>,\n) => p is QuadraticPath2d<T & DecreasingX>\n\n/** @internal */\nexport const isMonotonicX = methods.isMonotonicX as unknown as <T>(\n p: QuadraticPath2d<T>,\n) => p is QuadraticPath2d<T & MonotonicX>\n\n/** @internal */\nexport const isIncreasingY = methods.isIncreasingY as unknown as <T>(\n p: QuadraticPath2d<T>,\n) => p is QuadraticPath2d<T & IncreasingY>\n\n/** @internal */\nexport const isDecreasingY = methods.isDecreasingY as unknown as <T>(\n p: QuadraticPath2d<T>,\n) => p is QuadraticPath2d<T & DecreasingY>\n\n/** @internal */\nexport const isMonotonicY = methods.isMonotonicY as unknown as <T>(\n p: QuadraticPath2d<T>,\n) => p is QuadraticPath2d<T & MonotonicY>\n\n/** @internal */\nexport const asIncreasingX = <T>(p: QuadraticPath2d<T>): QuadraticPath2d<T & IncreasingX> => {\n invariant(isIncreasingX(p), 'quadratic path is not increasing in x')\n return p\n}\n\n/** @internal */\nexport const asDecreasingX = <T>(p: QuadraticPath2d<T>): QuadraticPath2d<T & DecreasingX> => {\n invariant(isDecreasingX(p), 'quadratic path is not decreasing in x')\n return p\n}\n\n/** @internal */\nexport const asMonotonicX = <T>(p: QuadraticPath2d<T>): QuadraticPath2d<T & MonotonicX> => {\n invariant(isMonotonicX(p), 'quadratic path is not monotonic in x')\n return p\n}\n\n/** @internal */\nexport const asIncreasingY = <T>(p: QuadraticPath2d<T>): QuadraticPath2d<T & IncreasingY> => {\n invariant(isIncreasingY(p), 'quadratic path is not increasing in y')\n return p\n}\n\n/** @internal */\nexport const asDecreasingY = <T>(p: QuadraticPath2d<T>): QuadraticPath2d<T & DecreasingY> => {\n invariant(isDecreasingY(p), 'quadratic path is not decreasing in y')\n return p\n}\n\n/** @internal */\nexport const asMonotonicY = <T>(p: QuadraticPath2d<T>): QuadraticPath2d<T & MonotonicY> => {\n invariant(isMonotonicY(p), 'quadratic path is not monotonic in y')\n return p\n}\n\n/** @internal */\nexport const solveAtX = methods.solveAtX as never\n\n/** @internal */\nexport const solveAtY = methods.solveAtY as never\n\n/** @internal */\nexport const boundingBox = methods.boundingBox as (p: QuadraticPath2d) => Interval2d<Closed, Closed>\n\n/** @internal */\nexport const transform = methods.transform as never\n","import type { Interval2d } from '../interval/interval2d.ts'\nimport type { QuadraticCurve2d } from '../curve/quadratic2d.ts'\nimport type { Closed } from '../interval/interval.ts'\nimport type * as Solution from '../solution/solution.ts'\nimport type { Affine2d } from '../transform/affine2d.ts'\nimport type { Pipeable } from '../utils.ts'\nimport type { Vector2 } from '../vector/vector2.ts'\nimport type { QuadraticPath2dTypeId } from './quadratic2d.internal.ts'\nimport * as internal from './quadratic2d.internal.ts'\nimport type {\n Continuous,\n DecreasingX,\n DecreasingY,\n IncreasingX,\n IncreasingY,\n MonotonicX,\n MonotonicY,\n PathTraits,\n} from './traits.ts'\n\nexport type {\n Continuous,\n DecreasingX,\n DecreasingY,\n IncreasingX,\n IncreasingY,\n MonotonicX,\n MonotonicY,\n} from './traits.ts'\n\n/**\n * A quadratic path in 2D space.\n *\n * All fields are readonly and immutable, and all operations create new instances.\n *\n * The `Trait` type parameter accumulates trait brands as the path is refined\n * via `isContinuous` / `asContinuous`.\n *\n * @since 1.0.0\n */\nexport interface QuadraticPath2d<out Trait = unknown> extends Pipeable, Iterable<QuadraticCurve2d> {\n readonly [QuadraticPath2dTypeId]: QuadraticPath2dTypeId\n readonly [PathTraits]: Trait\n}\n\n/**\n * Creates a new `QuadraticPath2d` instance from a sequence of curves.\n *\n * @param curves - The curves to create the path from.\n * @returns A new `QuadraticPath2d` instance.\n * @since 2.0.0\n */\nexport const make: (...curves: ReadonlyArray<QuadraticCurve2d>) => QuadraticPath2d = internal.make\n\n/**\n * Creates a new `QuadraticPath2d` instance from an array of curves.\n *\n * @param curves - The curves to create the path from.\n * @returns A new `QuadraticPath2d` instance.\n * @since 2.0.0\n */\nexport const fromArray: (curves: ReadonlyArray<QuadraticCurve2d>) => QuadraticPath2d =\n internal.fromArray\n\n/**\n * Checks if a value is a `QuadraticPath2d`.\n *\n * @param p - The value to check.\n * @returns `true` if the value is a `QuadraticPath2d`, `false` otherwise.\n * @since 1.0.0\n */\nexport const isQuadraticPath2d: (p: unknown) => p is QuadraticPath2d = internal.isQuadraticPath2d\n\nexport const append: {\n /**\n * Appends a quadratic curve to a quadratic path.\n *\n * @param c - The quadratic curve to append.\n * @returns A function that takes a quadratic path and returns a new quadratic path.\n * @since 1.0.0\n */\n (c: QuadraticCurve2d): (p: QuadraticPath2d) => QuadraticPath2d\n /**\n * Appends a quadratic curve to a quadratic path.\n *\n * @param p - The quadratic path to append to.\n * @param c - The quadratic curve to append.\n * @returns A new `QuadraticPath2d` instance with the appended curve.\n * @since 1.0.0\n */\n (p: QuadraticPath2d, c: QuadraticCurve2d): QuadraticPath2d\n} = internal.append\n\n/**\n * Calculates the length of a quadratic path.\n *\n * @param p - The quadratic path to calculate the length of.\n * @returns The length of the path.\n */\nexport const length: (p: QuadraticPath2d) => number = internal.length\n\nexport const solve: {\n /**\n * Solves a quadratic path at a given parameter.\n *\n * @param u - The parameter to solve for.\n * @returns A function that takes a quadratic path and returns the solved point.\n * @since 1.0.0\n */\n (u: number): (p: QuadraticPath2d) => Vector2\n /**\n * Solves a quadratic path at a given parameter.\n *\n * @param p - The quadratic path to solve.\n * @param u - The parameter to solve for.\n * @returns The solved point.\n * @since 1.0.0\n */\n (p: QuadraticPath2d, u: number): Vector2\n} = internal.solve\n\n/**\n * Serializes a quadratic path as an SVG path data string (the value of a\n * `<path>` element's `d` attribute), using `M` and `Q` commands. Discontinuities\n * between curves emit a fresh `M` command.\n *\n * @param p - The quadratic path to serialize.\n * @returns The SVG path data string.\n * @since 2.0.0\n */\nexport const toPathData: (p: QuadraticPath2d) => string = internal.toPathData\n\n/**\n * Type-narrowing predicate: refines `QuadraticPath2d<T>` to\n * `QuadraticPath2d<T & Continuous>` when adjacent curves connect.\n *\n * @since 2.0.0\n */\nexport const isContinuous: <T>(p: QuadraticPath2d<T>) => p is QuadraticPath2d<T & Continuous> =\n internal.isContinuous\n\n/**\n * Asserts that the quadratic path is continuous, throwing on failure.\n *\n * @since 2.0.0\n */\nexport const asContinuous: <T>(p: QuadraticPath2d<T>) => QuadraticPath2d<T & Continuous> =\n internal.asContinuous\n\n/**\n * Type-narrowing predicate: refines `QuadraticPath2d<T>` to\n * `QuadraticPath2d<T & IncreasingX>` when every segment's x-polynomial is\n * strictly increasing on `[0, 1]` and adjacent segments' x-ranges don't\n * overlap.\n *\n * @since 2.0.0\n */\nexport const isIncreasingX: <T>(p: QuadraticPath2d<T>) => p is QuadraticPath2d<T & IncreasingX> =\n internal.isIncreasingX\n\n/**\n * Type-narrowing predicate: refines `QuadraticPath2d<T>` to\n * `QuadraticPath2d<T & DecreasingX>`.\n *\n * @since 2.0.0\n */\nexport const isDecreasingX: <T>(p: QuadraticPath2d<T>) => p is QuadraticPath2d<T & DecreasingX> =\n internal.isDecreasingX\n\n/**\n * Type-narrowing predicate: refines `QuadraticPath2d<T>` to\n * `QuadraticPath2d<T & MonotonicX>`.\n *\n * @since 2.0.0\n */\nexport const isMonotonicX: <T>(p: QuadraticPath2d<T>) => p is QuadraticPath2d<T & MonotonicX> =\n internal.isMonotonicX\n\n/**\n * Type-narrowing predicate: refines `QuadraticPath2d<T>` to\n * `QuadraticPath2d<T & IncreasingY>`.\n *\n * @since 2.0.0\n */\nexport const isIncreasingY: <T>(p: QuadraticPath2d<T>) => p is QuadraticPath2d<T & IncreasingY> =\n internal.isIncreasingY\n\n/**\n * Type-narrowing predicate: refines `QuadraticPath2d<T>` to\n * `QuadraticPath2d<T & DecreasingY>`.\n *\n * @since 2.0.0\n */\nexport const isDecreasingY: <T>(p: QuadraticPath2d<T>) => p is QuadraticPath2d<T & DecreasingY> =\n internal.isDecreasingY\n\n/**\n * Type-narrowing predicate: refines `QuadraticPath2d<T>` to\n * `QuadraticPath2d<T & MonotonicY>`.\n *\n * @since 2.0.0\n */\nexport const isMonotonicY: <T>(p: QuadraticPath2d<T>) => p is QuadraticPath2d<T & MonotonicY> =\n internal.isMonotonicY\n\n/**\n * Asserts that the path is strictly increasing in x, throwing on failure.\n *\n * @since 2.0.0\n */\nexport const asIncreasingX: <T>(p: QuadraticPath2d<T>) => QuadraticPath2d<T & IncreasingX> =\n internal.asIncreasingX\n\n/**\n * Asserts that the path is strictly decreasing in x, throwing on failure.\n *\n * @since 2.0.0\n */\nexport const asDecreasingX: <T>(p: QuadraticPath2d<T>) => QuadraticPath2d<T & DecreasingX> =\n internal.asDecreasingX\n\n/**\n * Asserts that the path is monotonic in x, throwing on failure.\n *\n * @since 2.0.0\n */\nexport const asMonotonicX: <T>(p: QuadraticPath2d<T>) => QuadraticPath2d<T & MonotonicX> =\n internal.asMonotonicX\n\n/**\n * Asserts that the path is strictly increasing in y, throwing on failure.\n *\n * @since 2.0.0\n */\nexport const asIncreasingY: <T>(p: QuadraticPath2d<T>) => QuadraticPath2d<T & IncreasingY> =\n internal.asIncreasingY\n\n/**\n * Asserts that the path is strictly decreasing in y, throwing on failure.\n *\n * @since 2.0.0\n */\nexport const asDecreasingY: <T>(p: QuadraticPath2d<T>) => QuadraticPath2d<T & DecreasingY> =\n internal.asDecreasingY\n\n/**\n * Asserts that the path is monotonic in y, throwing on failure.\n *\n * @since 2.0.0\n */\nexport const asMonotonicY: <T>(p: QuadraticPath2d<T>) => QuadraticPath2d<T & MonotonicY> =\n internal.asMonotonicY\n\nexport const solveAtX: {\n /**\n * Evaluates the path's y value at a given x. Requires the path to carry\n * the `MonotonicX` brand. Returns `Solution.none` when x is outside the\n * path's x-range.\n *\n * @param p - A path branded `MonotonicX`.\n * @param x - The x coordinate.\n * @returns The y value at x, or `none` when x is outside the path's range.\n * @since 2.0.0\n */\n <T extends MonotonicX>(p: QuadraticPath2d<T>, x: number): Solution.AtMostOne<number>\n /** @since 2.0.0 */\n (x: number): <T extends MonotonicX>(p: QuadraticPath2d<T>) => Solution.AtMostOne<number>\n} = internal.solveAtX as never\n\nexport const solveAtY: {\n /**\n * Evaluates the path's x value at a given y. Requires the path to carry\n * the `MonotonicY` brand. Returns `Solution.none` when y is outside the\n * path's y-range.\n *\n * @param p - A path branded `MonotonicY`.\n * @param y - The y coordinate.\n * @returns The x value at y, or `none` when y is outside the path's range.\n * @since 2.0.0\n */\n <T extends MonotonicY>(p: QuadraticPath2d<T>, y: number): Solution.AtMostOne<number>\n /** @since 2.0.0 */\n (y: number): <T extends MonotonicY>(p: QuadraticPath2d<T>) => Solution.AtMostOne<number>\n} = internal.solveAtY as never\n\n/**\n * Computes the axis-aligned bounding box of the path — the smallest closed\n * `Box2d` enclosing every segment.\n *\n * @param p - The quadratic path.\n * @returns A closed `Box2d` enclosing the path.\n * @since 2.0.0\n */\nexport const boundingBox: (p: QuadraticPath2d) => Interval2d<Closed, Closed> = internal.boundingBox\n\nexport const transform: {\n /**\n * Applies an `Affine2d` transform to every curve in a `QuadraticPath2d`,\n * returning a new path whose image is the affine image of the original.\n * Trait brands are dropped.\n *\n * @param p - The quadratic path.\n * @param a - The affine transform.\n * @returns A new unbranded `QuadraticPath2d` whose curves are the affine images of the input's.\n * @since 2.0.0\n */\n (p: QuadraticPath2d, a: Affine2d): QuadraticPath2d\n /**\n * Applies an `Affine2d` transform to every curve in a `QuadraticPath2d`.\n *\n * @param a - The affine transform.\n * @returns A function that takes a `QuadraticPath2d` and returns the transformed path.\n * @since 2.0.0\n */\n (a: Affine2d): (p: QuadraticPath2d) => QuadraticPath2d\n} = internal.transform\n"],"mappings":";;;;;AAiBA,MAAa,wBAAuC,OAAO,yBAAyB;AAIpF,MAAM,UAAUA,YAAmB,uBAAuBC,IAA2B;;AAGrF,MAAaC,uBAAqB,MAChC,OAAO,MAAM,YAAY,MAAM,QAAQ,yBAAyB;;AAGlE,MAAaC,SAAO,QAAQ;;AAK5B,MAAaC,cAAY,QAAQ;;AAKjC,MAAaC,WAAS,QAAQ;;AAG9B,MAAaC,WAAS,QAAQ;;AAG9B,MAAaC,UAAQ,QAAQ;;AAG7B,MAAaC,eAAa,QAAQ;;AAGlC,MAAaC,iBAAe,QAAQ;;AAKpC,MAAaC,kBAAmB,MAA2D;CACzF,UAAUD,eAAa,EAAE,EAAE,mCAAmC;CAC9D,OAAO;;;AAIT,MAAaE,kBAAgB,QAAQ;;AAKrC,MAAaC,kBAAgB,QAAQ;;AAKrC,MAAaC,iBAAe,QAAQ;;AAKpC,MAAaC,kBAAgB,QAAQ;;AAKrC,MAAaC,kBAAgB,QAAQ;;AAKrC,MAAaC,iBAAe,QAAQ;;AAKpC,MAAaC,mBAAoB,MAA4D;CAC3F,UAAUN,gBAAc,EAAE,EAAE,wCAAwC;CACpE,OAAO;;;AAIT,MAAaO,mBAAoB,MAA4D;CAC3F,UAAUN,gBAAc,EAAE,EAAE,wCAAwC;CACpE,OAAO;;;AAIT,MAAaO,kBAAmB,MAA2D;CACzF,UAAUN,eAAa,EAAE,EAAE,uCAAuC;CAClE,OAAO;;;AAIT,MAAaO,mBAAoB,MAA4D;CAC3F,UAAUN,gBAAc,EAAE,EAAE,wCAAwC;CACpE,OAAO;;;AAIT,MAAaO,mBAAoB,MAA4D;CAC3F,UAAUN,gBAAc,EAAE,EAAE,wCAAwC;CACpE,OAAO;;;AAIT,MAAaO,kBAAmB,MAA2D;CACzF,UAAUN,eAAa,EAAE,EAAE,uCAAuC;CAClE,OAAO;;;AAIT,MAAaO,aAAW,QAAQ;;AAGhC,MAAaC,aAAW,QAAQ;;AAGhC,MAAaC,gBAAc,QAAQ;;AAGnC,MAAaC,cAAY,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACpFjC,MAAa,OAAwEC;;;;;;;;AASrF,MAAa,YACXC;;;;;;;;AASF,MAAa,oBAA0DC;AAEvE,MAAa,SAkBTC;;;;;;;AAQJ,MAAa,SAAyCC;AAEtD,MAAa,QAkBTC;;;;;;;;;;AAWJ,MAAa,aAA6CC;;;;;;;AAQ1D,MAAa,eACXC;;;;;;AAOF,MAAa,eACXC;;;;;;;;;AAUF,MAAa,gBACXC;;;;;;;AAQF,MAAa,gBACXC;;;;;;;AAQF,MAAa,eACXC;;;;;;;AAQF,MAAa,gBACXC;;;;;;;AAQF,MAAa,gBACXC;;;;;;;AAQF,MAAa,eACXC;;;;;;AAOF,MAAa,gBACXC;;;;;;AAOF,MAAa,gBACXC;;;;;;AAOF,MAAa,eACXC;;;;;;AAOF,MAAa,gBACXC;;;;;;AAOF,MAAa,gBACXC;;;;;;AAOF,MAAa,eACXC;AAEF,MAAa,WAcTC;AAEJ,MAAa,WAcTC;;;;;;;;;AAUJ,MAAa,cAAkEC;AAE/E,MAAa,YAoBTC"}
|
|
@@ -5,7 +5,7 @@ import { a as magnitude } from "./vector2-DuA3EmfL.mjs";
|
|
|
5
5
|
import { l as make$6, p as unit } from "./interval-Dcqpo73t.mjs";
|
|
6
6
|
import { c as one, i as isNone, s as none } from "./solution-BW0BBMXI.mjs";
|
|
7
7
|
import { a as union } from "./interval2d-C2Pk66-2.mjs";
|
|
8
|
-
import {
|
|
8
|
+
import { a as solve$8, d as solve$7, f as Ops$1, h as solve$6, n as boundingBox$6, o as transform$6, p as derivative, t as approximateAsCubicCurves, u as length$4, y as Ops } from "./rationalCubic2d-gM7VeiiT.mjs";
|
|
9
9
|
//#region src/path/path2d.ts
|
|
10
10
|
/**
|
|
11
11
|
* Concrete implementation backing every `Path2d<C>`. The per-kind `TypeId`
|
|
@@ -852,4 +852,4 @@ const transform = transform$1;
|
|
|
852
852
|
//#endregion
|
|
853
853
|
export { fromArray$4 as a, make$2 as i, rationalCubic2d_exports as n, linear2d_exports as o, cubic2d_exports as r, makeMethods as s, fromArray as t };
|
|
854
854
|
|
|
855
|
-
//# sourceMappingURL=rationalCubic2d-
|
|
855
|
+
//# sourceMappingURL=rationalCubic2d-CZiP8nIq.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rationalCubic2d-CZiP8nIq.mjs","names":["Interval.unit","Solution.one","Solution.isNone","Solution.none","Interval2d.union","methods","Path2d.makeMethods","linearCurveInternal.Ops","isLinearPath2d","make","fromArray","append","length","solve","toPathData","isContinuous","asContinuous","isIncreasingX","isDecreasingX","isMonotonicX","isIncreasingY","isDecreasingY","isMonotonicY","asIncreasingX","asDecreasingX","asMonotonicX","asIncreasingY","asDecreasingY","asMonotonicY","solveAtX","solveAtY","boundingBox","transform","make","internal.make","fromArray","internal.fromArray","internal.isLinearPath2d","append","internal.append","length","internal.length","solve","internal.solve","toPathData","internal.toPathData","isContinuous","internal.isContinuous","asContinuous","internal.asContinuous","isIncreasingX","internal.isIncreasingX","isDecreasingX","internal.isDecreasingX","isMonotonicX","internal.isMonotonicX","isIncreasingY","internal.isIncreasingY","isDecreasingY","internal.isDecreasingY","isMonotonicY","internal.isMonotonicY","asIncreasingX","internal.asIncreasingX","asDecreasingX","internal.asDecreasingX","asMonotonicX","internal.asMonotonicX","asIncreasingY","internal.asIncreasingY","asDecreasingY","internal.asDecreasingY","asMonotonicY","internal.asMonotonicY","solveAtX","internal.solveAtX","solveAtY","internal.solveAtY","boundingBox","internal.boundingBox","transform","internal.transform","Path2d.makeMethods","cubicCurveInternal.Ops","isCubicPath2d","make","fromArray","append","length","solve","toPathData","isContinuous","asContinuous","isIncreasingX","isDecreasingX","isMonotonicX","isIncreasingY","isDecreasingY","isMonotonicY","asIncreasingX","asDecreasingX","asMonotonicX","asIncreasingY","asDecreasingY","asMonotonicY","solveAtX","solveAtY","boundingBox","transform","CubicCurve2d.length","Interval.unit","derivative","cubicCurveInternal.derivative","Interval.make","Vector2.magnitude","QuadraticCurve2d.solve","solveByDistance","Path2d.Path2dImpl","CubicCurve2d.solve","make","internal.make","fromArray","internal.fromArray","internal.isCubicPath2d","append","internal.append","internal.length","solve","internal.solve","internal.toPathData","internal.isContinuous","internal.asContinuous","internal.isIncreasingX","internal.isDecreasingX","internal.isMonotonicX","internal.isIncreasingY","internal.isDecreasingY","internal.isMonotonicY","internal.asIncreasingX","internal.asDecreasingX","internal.asMonotonicX","internal.asIncreasingY","internal.asDecreasingY","internal.asMonotonicY","internal.solveAtX","internal.solveAtY","internal.solveByDistance","boundingBox","internal.boundingBox","transform","internal.transform","isRationalCubicPath2d","make","fromArray","append","solve","RationalCubicCurve2d.solve","boundingBox","RationalCubicCurve2d.boundingBox","Interval2d.union","approximateAsCubicPath","RationalCubicCurve2d.approximateAsCubicCurves","CubicPath2d.fromArray","transform","RationalCubicCurve2d.transform","internal.isRationalCubicPath2d","internal.make","internal.fromArray","internal.append","internal.solve","internal.boundingBox","internal.approximateAsCubicPath","internal.transform"],"sources":["../../src/path/path2d.ts","../../src/path/linear2d.internal.ts","../../src/path/linear2d.ts","../../src/path/cubic2d.internal.ts","../../src/path/cubic2d.ts","../../src/path/rationalCubic2d.internal.ts","../../src/path/rationalCubic2d.ts"],"sourcesContent":["import type { Curve2dOps } from '../curve/curve2d.ts'\nimport * as Interval from '../interval/interval.ts'\nimport * as Interval2d from '../interval/interval2d.ts'\nimport { coincident } from '../number.ts'\nimport * as Solution from '../solution/solution.ts'\nimport type { Affine2d } from '../transform/affine2d.ts'\nimport { dual, Pipeable } from '../utils.ts'\nimport type { Vector2 } from '../vector/vector2.ts'\nimport {\n PathTraits,\n type Continuous,\n type DecreasingX,\n type DecreasingY,\n type IncreasingX,\n type IncreasingY,\n type MonotonicX,\n type MonotonicY,\n} from './traits.ts'\n\n/**\n * Generic 2D path — a sequence of curves of a single kind `C` plus optional\n * trait brands (`Continuous`, `MonotonicX`, etc.) tracking properties of the\n * path as a whole.\n *\n * Each concrete path kind (`LinearPath2d`, `QuadraticPath2d`, `CubicPath2d`)\n * is a `Path2d<TheirCurveKind, Trait>` plus a per-kind `TypeId` slot for\n * cheap runtime identification. The per-kind modules re-export an operation\n * surface derived from {@link makeMethods} over their curve's\n * {@link Curve2dOps}.\n *\n * @since 2.0.0\n */\nexport interface Path2d<C, Trait = unknown> extends Pipeable, Iterable<C> {\n readonly [PathTraits]: Trait\n}\n\n/**\n * Concrete implementation backing every `Path2d<C>`. The per-kind `TypeId`\n * symbol is stamped onto each instance as a dynamic property at the symbol\n * key it identifies, so the existing per-kind `is{Linear,Quadratic,Cubic}Path2d`\n * typeguards continue to work as `TypeId in p` checks.\n *\n * @internal\n */\nexport class Path2dImpl<C> extends Pipeable implements Path2d<C, unknown> {\n declare readonly [PathTraits]: unknown\n readonly curves: ReadonlyArray<C>\n\n constructor(typeId: symbol, curves: ReadonlyArray<C>) {\n super()\n ;(this as unknown as Record<symbol, symbol>)[typeId] = typeId\n this.curves = curves\n }\n\n [Symbol.iterator](): Iterator<C> {\n return this.curves[Symbol.iterator]()\n }\n}\n\n/**\n * Builds the bundle of generic path operations for a curve kind `C`, given\n * that curve's {@link Curve2dOps} and the per-kind `TypeId` symbol. Each\n * polynomial-degree path module calls this once and re-exports the returned\n * functions with curve-narrowed signatures.\n *\n * `ops` and `typeId` are captured by closure, so the returned operations\n * incur no per-call lookup overhead.\n *\n * @since 2.0.0\n */\nexport const makeMethods = <C>(typeId: symbol, ops: Curve2dOps<C>) => {\n const fromArray = (curves: ReadonlyArray<C>): Path2d<C> => new Path2dImpl(typeId, curves)\n\n const make = (...curves: ReadonlyArray<C>): Path2d<C> => fromArray(curves)\n\n const append = dual<(c: C) => (p: Path2d<C>) => Path2d<C>, (p: Path2d<C>, c: C) => Path2d<C>>(\n 2,\n (p: Path2d<C>, c: C) => fromArray([...p, c]),\n )\n\n const length = (p: Path2d<C>): number => {\n let total = 0\n for (const curve of p) {\n total += ops.length(curve, Interval.unit)\n }\n return total\n }\n\n const solve = dual<\n (u: number) => (p: Path2d<C>) => Vector2,\n (p: Path2d<C>, u: number) => Vector2\n >(2, (p: Path2d<C>, u: number) => {\n const curves = p instanceof Path2dImpl ? (p.curves as ReadonlyArray<C>) : [...p]\n if (u === 1) {\n return ops.solve(curves.at(-1) as C, 1)\n }\n const t = u * curves.length\n const i = Math.floor(t)\n return ops.solve(curves[i] as C, t - i)\n })\n\n const toPathData = (p: Path2d<C>): string => {\n let result = ''\n let prevEndX = Number.NaN\n let prevEndY = Number.NaN\n\n for (const curve of p) {\n const start = ops.startPoint(curve)\n const end = ops.endPoint(curve)\n\n if (!coincident(start.x, prevEndX) || !coincident(start.y, prevEndY)) {\n result += ` M ${start.x},${start.y}`\n }\n result += ` ${ops.toPathDataSegment(curve)}`\n\n prevEndX = end.x\n prevEndY = end.y\n }\n\n return result.slice(1)\n }\n\n const isContinuous = <T>(p: Path2d<C, T>): p is Path2d<C, T & Continuous> => {\n let prevEndX = Number.NaN\n let prevEndY = Number.NaN\n let first = true\n\n for (const curve of p) {\n const start = ops.startPoint(curve)\n if (!first && (!coincident(start.x, prevEndX) || !coincident(start.y, prevEndY))) {\n return false\n }\n const end = ops.endPoint(curve)\n prevEndX = end.x\n prevEndY = end.y\n first = false\n }\n return true\n }\n\n // Per-axis monotonicity for the path: every segment's axis polynomial must\n // be strictly monotonic over the unit interval AND adjacent segments' axis\n // ranges must not overlap — a knot that backtracks within the coincidence\n // band counts as continuous rather than as a reversal.\n const isIncreasingX = <T>(p: Path2d<C, T>): p is Path2d<C, T & IncreasingX> => {\n let prevEnd = Number.NEGATIVE_INFINITY\n for (const c of p) {\n if (!ops.isIncreasingX(c)) {\n return false\n }\n const start = ops.startPoint(c).x\n if (start < prevEnd && !coincident(start, prevEnd)) {\n return false\n }\n prevEnd = ops.endPoint(c).x\n }\n return true\n }\n\n const isDecreasingX = <T>(p: Path2d<C, T>): p is Path2d<C, T & DecreasingX> => {\n let prevEnd = Number.POSITIVE_INFINITY\n for (const c of p) {\n if (!ops.isDecreasingX(c)) {\n return false\n }\n const start = ops.startPoint(c).x\n if (start > prevEnd && !coincident(start, prevEnd)) {\n return false\n }\n prevEnd = ops.endPoint(c).x\n }\n return true\n }\n\n const isMonotonicX = <T>(p: Path2d<C, T>): p is Path2d<C, T & MonotonicX> =>\n isIncreasingX(p) || isDecreasingX(p)\n\n const isIncreasingY = <T>(p: Path2d<C, T>): p is Path2d<C, T & IncreasingY> => {\n let prevEnd = Number.NEGATIVE_INFINITY\n for (const c of p) {\n if (!ops.isIncreasingY(c)) {\n return false\n }\n const start = ops.startPoint(c).y\n if (start < prevEnd && !coincident(start, prevEnd)) {\n return false\n }\n prevEnd = ops.endPoint(c).y\n }\n return true\n }\n\n const isDecreasingY = <T>(p: Path2d<C, T>): p is Path2d<C, T & DecreasingY> => {\n let prevEnd = Number.POSITIVE_INFINITY\n for (const c of p) {\n if (!ops.isDecreasingY(c)) {\n return false\n }\n const start = ops.startPoint(c).y\n if (start > prevEnd && !coincident(start, prevEnd)) {\n return false\n }\n prevEnd = ops.endPoint(c).y\n }\n return true\n }\n\n const isMonotonicY = <T>(p: Path2d<C, T>): p is Path2d<C, T & MonotonicY> =>\n isIncreasingY(p) || isDecreasingY(p)\n\n // solveAtX / solveAtY on a monotonic-axis path. Two defenses against float\n // drift at interior knots, where two adjacent segments both bracket the\n // query and the per-curve inverse may return `none` for both:\n // 1. Snap to t=0/t=1 endpoint y when the query is coincident with a\n // segment's start or end — bypasses polynomial inversion at knots.\n // 2. Fall through to the next bracketing segment on `none`. `MonotonicX`/Y\n // admits at most one real solution across the path, so retrying is safe.\n const solveAtX = dual(2, (p: Path2d<C>, x: number): Solution.AtMostOne<number> => {\n for (const c of p) {\n const start = ops.startPoint(c)\n const end = ops.endPoint(c)\n const lo = Math.min(start.x, end.x)\n const hi = Math.max(start.x, end.x)\n if ((x >= lo && x <= hi) || coincident(x, lo) || coincident(x, hi)) {\n if (coincident(x, start.x)) {\n return Solution.one(start.y)\n }\n if (coincident(x, end.x)) {\n return Solution.one(end.y)\n }\n const sol = ops.solveAtX(c, x)\n if (!Solution.isNone(sol)) {\n return sol\n }\n }\n }\n return Solution.none\n })\n\n const solveAtY = dual(2, (p: Path2d<C>, y: number): Solution.AtMostOne<number> => {\n for (const c of p) {\n const start = ops.startPoint(c)\n const end = ops.endPoint(c)\n const lo = Math.min(start.y, end.y)\n const hi = Math.max(start.y, end.y)\n if ((y >= lo && y <= hi) || coincident(y, lo) || coincident(y, hi)) {\n if (coincident(y, start.y)) {\n return Solution.one(start.x)\n }\n if (coincident(y, end.y)) {\n return Solution.one(end.x)\n }\n const sol = ops.solveAtY(c, y)\n if (!Solution.isNone(sol)) {\n return sol\n }\n }\n }\n return Solution.none\n })\n\n const boundingBox = (p: Path2d<C>): Interval2d.Interval2d<Interval.Closed, Interval.Closed> => {\n const iter = p[Symbol.iterator]()\n const first = iter.next()\n let acc = ops.boundingBox(first.value as C)\n for (let next = iter.next(); !next.done; next = iter.next()) {\n acc = Interval2d.union(acc, ops.boundingBox(next.value))\n }\n return acc\n }\n\n // Per-curve transform: the curve-level op already encodes the right\n // coefficient-vs-position split for its degree, so the path-level call is\n // just a map. Trait brands are dropped — affine maps preserve continuity\n // (since image of a connected set is connected) but can flip monotonicity\n // sense (a reflection inverts increasing → decreasing) so the brands must\n // be reasserted on the result if the caller still wants them.\n const transform = dual<\n (a: Affine2d) => (p: Path2d<C>) => Path2d<C>,\n (p: Path2d<C>, a: Affine2d) => Path2d<C>\n >(2, (p: Path2d<C>, a: Affine2d) => {\n const curves: Array<C> = []\n for (const c of p) {\n curves.push(ops.transform(c, a))\n }\n return fromArray(curves)\n })\n\n return {\n fromArray,\n make,\n append,\n length,\n solve,\n toPathData,\n isContinuous,\n isIncreasingX,\n isDecreasingX,\n isMonotonicX,\n isIncreasingY,\n isDecreasingY,\n isMonotonicY,\n solveAtX,\n solveAtY,\n boundingBox,\n transform,\n }\n}\n","import type * as LinearCurve2d from '../curve/linear2d.ts'\nimport * as linearCurveInternal from '../curve/linear2d.internal.ts'\nimport type { Closed } from '../interval/interval.ts'\nimport type { Interval2d } from '../interval/interval2d.ts'\nimport { invariant } from '../utils.ts'\nimport type { LinearPath2d } from './linear2d.ts'\nimport * as Path2d from './path2d.ts'\nimport {\n type Continuous,\n type DecreasingX,\n type DecreasingY,\n type IncreasingX,\n type IncreasingY,\n type MonotonicX,\n type MonotonicY,\n} from './traits.ts'\n\nexport const LinearPath2dTypeId: unique symbol = Symbol('curvy/path/linear2d')\nexport type LinearPath2dTypeId = typeof LinearPath2dTypeId\n\n// Generic operation surface, built once for LinearCurve2d's Ops.\nconst methods = Path2d.makeMethods(LinearPath2dTypeId, linearCurveInternal.Ops)\n\n/** @internal */\nexport const isLinearPath2d = (p: unknown): p is LinearPath2d =>\n typeof p === 'object' && p !== null && LinearPath2dTypeId in p\n\n/** @internal */\nexport const make = methods.make as (\n ...curves: ReadonlyArray<LinearCurve2d.LinearCurve2d>\n) => LinearPath2d\n\n/** @internal */\nexport const fromArray = methods.fromArray as (\n curves: ReadonlyArray<LinearCurve2d.LinearCurve2d>,\n) => LinearPath2d\n\n/** @internal */\nexport const append = methods.append as never\n\n/** @internal */\nexport const length = methods.length as (p: LinearPath2d) => number\n\n/** @internal */\nexport const solve = methods.solve as never\n\n/** @internal */\nexport const toPathData = methods.toPathData as (p: LinearPath2d) => string\n\n/** @internal */\nexport const isContinuous = methods.isContinuous as unknown as <T>(\n p: LinearPath2d<T>,\n) => p is LinearPath2d<T & Continuous>\n\n/** @internal */\nexport const asContinuous = <T>(p: LinearPath2d<T>): LinearPath2d<T & Continuous> => {\n invariant(isContinuous(p), 'linear path is not continuous')\n return p\n}\n\n/** @internal */\nexport const isIncreasingX = methods.isIncreasingX as unknown as <T>(\n p: LinearPath2d<T>,\n) => p is LinearPath2d<T & IncreasingX>\n\n/** @internal */\nexport const isDecreasingX = methods.isDecreasingX as unknown as <T>(\n p: LinearPath2d<T>,\n) => p is LinearPath2d<T & DecreasingX>\n\n/** @internal */\nexport const isMonotonicX = methods.isMonotonicX as unknown as <T>(\n p: LinearPath2d<T>,\n) => p is LinearPath2d<T & MonotonicX>\n\n/** @internal */\nexport const isIncreasingY = methods.isIncreasingY as unknown as <T>(\n p: LinearPath2d<T>,\n) => p is LinearPath2d<T & IncreasingY>\n\n/** @internal */\nexport const isDecreasingY = methods.isDecreasingY as unknown as <T>(\n p: LinearPath2d<T>,\n) => p is LinearPath2d<T & DecreasingY>\n\n/** @internal */\nexport const isMonotonicY = methods.isMonotonicY as unknown as <T>(\n p: LinearPath2d<T>,\n) => p is LinearPath2d<T & MonotonicY>\n\n/** @internal */\nexport const asIncreasingX = <T>(p: LinearPath2d<T>): LinearPath2d<T & IncreasingX> => {\n invariant(isIncreasingX(p), 'linear path is not increasing in x')\n return p\n}\n\n/** @internal */\nexport const asDecreasingX = <T>(p: LinearPath2d<T>): LinearPath2d<T & DecreasingX> => {\n invariant(isDecreasingX(p), 'linear path is not decreasing in x')\n return p\n}\n\n/** @internal */\nexport const asMonotonicX = <T>(p: LinearPath2d<T>): LinearPath2d<T & MonotonicX> => {\n invariant(isMonotonicX(p), 'linear path is not monotonic in x')\n return p\n}\n\n/** @internal */\nexport const asIncreasingY = <T>(p: LinearPath2d<T>): LinearPath2d<T & IncreasingY> => {\n invariant(isIncreasingY(p), 'linear path is not increasing in y')\n return p\n}\n\n/** @internal */\nexport const asDecreasingY = <T>(p: LinearPath2d<T>): LinearPath2d<T & DecreasingY> => {\n invariant(isDecreasingY(p), 'linear path is not decreasing in y')\n return p\n}\n\n/** @internal */\nexport const asMonotonicY = <T>(p: LinearPath2d<T>): LinearPath2d<T & MonotonicY> => {\n invariant(isMonotonicY(p), 'linear path is not monotonic in y')\n return p\n}\n\n/** @internal */\nexport const solveAtX = methods.solveAtX as never\n\n/** @internal */\nexport const solveAtY = methods.solveAtY as never\n\n/** @internal */\nexport const boundingBox = methods.boundingBox as (p: LinearPath2d) => Interval2d<Closed, Closed>\n\n/** @internal */\nexport const transform = methods.transform as never\n","import type { Interval2d } from '../interval/interval2d.ts'\nimport type { LinearCurve2d } from '../curve/linear2d.ts'\nimport type { Closed } from '../interval/interval.ts'\nimport type * as Solution from '../solution/solution.ts'\nimport type { Affine2d } from '../transform/affine2d.ts'\nimport type { Pipeable } from '../utils.ts'\nimport type { Vector2 } from '../vector/vector2.ts'\nimport type { LinearPath2dTypeId } from './linear2d.internal.ts'\nimport * as internal from './linear2d.internal.ts'\nimport type {\n Continuous,\n DecreasingX,\n DecreasingY,\n IncreasingX,\n IncreasingY,\n MonotonicX,\n MonotonicY,\n PathTraits,\n} from './traits.ts'\n\nexport type {\n Continuous,\n DecreasingX,\n DecreasingY,\n IncreasingX,\n IncreasingY,\n MonotonicX,\n MonotonicY,\n} from './traits.ts'\n\n/**\n * A linear path in 2D space.\n *\n * All fields are readonly and immutable, and all operations create new instances.\n *\n * The `Trait` type parameter accumulates trait brands as the path is refined\n * via `isContinuous` / `asContinuous`. A `Continuous` path's `toPathData`\n * skips the per-segment discontinuity check.\n *\n * @since 1.0.0\n */\nexport interface LinearPath2d<out Trait = unknown> extends Pipeable, Iterable<LinearCurve2d> {\n readonly [LinearPath2dTypeId]: LinearPath2dTypeId\n readonly [PathTraits]: Trait\n}\n\n/**\n * Creates a new `LinearPath2d` instance from a sequence of curves.\n *\n * @param curves - The curves to create the path from.\n * @returns A new `LinearPath2d` instance.\n * @since 2.0.0\n */\nexport const make: (...curves: ReadonlyArray<LinearCurve2d>) => LinearPath2d = internal.make\n\n/**\n * Creates a new `LinearPath2d` instance from an array of curves.\n *\n * @param curves - The curves to create the path from.\n * @returns A new `LinearPath2d` instance.\n * @since 2.0.0\n */\nexport const fromArray: (curves: ReadonlyArray<LinearCurve2d>) => LinearPath2d = internal.fromArray\n\n/**\n * Checks if a value is a `LinearPath2d`.\n *\n * @param p - The value to check.\n * @returns `true` if the value is a `LinearPath2d`, `false` otherwise.\n * @since 1.0.0\n */\nexport const isLinearPath2d: (p: unknown) => p is LinearPath2d = internal.isLinearPath2d\n\nexport const append: {\n /**\n * Appends a linear curve to a linear path.\n *\n * @param c - The linear curve to append.\n * @returns A function that takes a linear path and returns a new linear path.\n * @since 1.0.0\n */\n (c: LinearCurve2d): (p: LinearPath2d) => LinearPath2d\n /**\n * Appends a linear curve to a linear path.\n *\n * @param p - The linear path to append to.\n * @param c - The linear curve to append.\n * @returns A new `LinearPath2d` instance with the appended curve.\n * @since 1.0.0\n */\n (p: LinearPath2d, c: LinearCurve2d): LinearPath2d\n} = internal.append\n\n/**\n * Calculates the length of a linear path.\n *\n * @param p - The linear path to calculate the length of.\n * @returns The length of the linear path.\n * @since 1.0.0\n */\nexport const length: (p: LinearPath2d) => number = internal.length\n\nexport const solve: {\n /**\n * Solves a linear path for a given parameter.\n *\n * @param u - The parameter to solve for.\n * @returns A function that takes a linear path and returns the solved point.\n * @since 1.0.0\n */\n (u: number): (p: LinearPath2d) => Vector2\n /**\n * Solves a linear path for a given parameter.\n *\n * @param p - The linear path to solve.\n * @param u - The parameter to solve for.\n * @returns The solved point on the linear path.\n * @since 1.0.0\n */\n (p: LinearPath2d, u: number): Vector2\n} = internal.solve\n\n/**\n * Serializes a linear path as an SVG path data string (the value of a `<path>`\n * element's `d` attribute), using `M` and `L` commands. Discontinuities between\n * curves emit a fresh `M` command.\n *\n * @param p - The linear path to serialize.\n * @returns The SVG path data string.\n * @since 2.0.0\n */\nexport const toPathData: (p: LinearPath2d) => string = internal.toPathData\n\n/**\n * Type-narrowing predicate: refines `LinearPath2d<T>` to\n * `LinearPath2d<T & Continuous>` when adjacent curves connect at their join\n * points.\n *\n * @param p - The linear path to check.\n * @returns `true` when the path is continuous (G⁰).\n * @since 2.0.0\n */\nexport const isContinuous: <T>(p: LinearPath2d<T>) => p is LinearPath2d<T & Continuous> =\n internal.isContinuous\n\n/**\n * Asserts that the linear path is continuous, throwing on failure.\n *\n * @param p - The linear path to assert against.\n * @returns The same path, typed with the `Continuous` brand.\n * @throws When the path has a discontinuity between adjacent curves.\n * @since 2.0.0\n */\nexport const asContinuous: <T>(p: LinearPath2d<T>) => LinearPath2d<T & Continuous> =\n internal.asContinuous\n\n/**\n * Type-narrowing predicate: refines `LinearPath2d<T>` to\n * `LinearPath2d<T & IncreasingX>` when every segment's x-polynomial is\n * strictly increasing and adjacent segments' x-ranges don't overlap.\n *\n * @since 2.0.0\n */\nexport const isIncreasingX: <T>(p: LinearPath2d<T>) => p is LinearPath2d<T & IncreasingX> =\n internal.isIncreasingX\n\n/**\n * Type-narrowing predicate: refines `LinearPath2d<T>` to\n * `LinearPath2d<T & DecreasingX>` when every segment's x-polynomial is\n * strictly decreasing and adjacent segments' x-ranges don't overlap.\n *\n * @since 2.0.0\n */\nexport const isDecreasingX: <T>(p: LinearPath2d<T>) => p is LinearPath2d<T & DecreasingX> =\n internal.isDecreasingX\n\n/**\n * Type-narrowing predicate: refines `LinearPath2d<T>` to\n * `LinearPath2d<T & MonotonicX>` when the path is either increasing or\n * decreasing in x along its full parameter domain.\n *\n * @since 2.0.0\n */\nexport const isMonotonicX: <T>(p: LinearPath2d<T>) => p is LinearPath2d<T & MonotonicX> =\n internal.isMonotonicX\n\n/**\n * Type-narrowing predicate: refines `LinearPath2d<T>` to\n * `LinearPath2d<T & IncreasingY>`. The y-axis analog of {@link isIncreasingX}.\n *\n * @since 2.0.0\n */\nexport const isIncreasingY: <T>(p: LinearPath2d<T>) => p is LinearPath2d<T & IncreasingY> =\n internal.isIncreasingY\n\n/**\n * Type-narrowing predicate: refines `LinearPath2d<T>` to\n * `LinearPath2d<T & DecreasingY>`. The y-axis analog of {@link isDecreasingX}.\n *\n * @since 2.0.0\n */\nexport const isDecreasingY: <T>(p: LinearPath2d<T>) => p is LinearPath2d<T & DecreasingY> =\n internal.isDecreasingY\n\n/**\n * Type-narrowing predicate: refines `LinearPath2d<T>` to\n * `LinearPath2d<T & MonotonicY>`. The y-axis analog of {@link isMonotonicX}.\n *\n * @since 2.0.0\n */\nexport const isMonotonicY: <T>(p: LinearPath2d<T>) => p is LinearPath2d<T & MonotonicY> =\n internal.isMonotonicY\n\n/**\n * Asserts that the path is strictly increasing in x, throwing on failure.\n *\n * @since 2.0.0\n */\nexport const asIncreasingX: <T>(p: LinearPath2d<T>) => LinearPath2d<T & IncreasingX> =\n internal.asIncreasingX\n\n/**\n * Asserts that the path is strictly decreasing in x, throwing on failure.\n *\n * @since 2.0.0\n */\nexport const asDecreasingX: <T>(p: LinearPath2d<T>) => LinearPath2d<T & DecreasingX> =\n internal.asDecreasingX\n\n/**\n * Asserts that the path is monotonic in x, throwing on failure.\n *\n * @since 2.0.0\n */\nexport const asMonotonicX: <T>(p: LinearPath2d<T>) => LinearPath2d<T & MonotonicX> =\n internal.asMonotonicX\n\n/**\n * Asserts that the path is strictly increasing in y, throwing on failure.\n *\n * @since 2.0.0\n */\nexport const asIncreasingY: <T>(p: LinearPath2d<T>) => LinearPath2d<T & IncreasingY> =\n internal.asIncreasingY\n\n/**\n * Asserts that the path is strictly decreasing in y, throwing on failure.\n *\n * @since 2.0.0\n */\nexport const asDecreasingY: <T>(p: LinearPath2d<T>) => LinearPath2d<T & DecreasingY> =\n internal.asDecreasingY\n\n/**\n * Asserts that the path is monotonic in y, throwing on failure.\n *\n * @since 2.0.0\n */\nexport const asMonotonicY: <T>(p: LinearPath2d<T>) => LinearPath2d<T & MonotonicY> =\n internal.asMonotonicY\n\nexport const solveAtX: {\n /**\n * Evaluates the path's y value at a given x. Requires the path to carry the\n * `MonotonicX` brand — without it, an x query could match multiple\n * segments and the return cardinality would be unbounded.\n *\n * Returns `Solution.none` when x falls outside the path's x-range.\n *\n * @param p - A path branded `MonotonicX`.\n * @param x - The x coordinate.\n * @returns The y value at x, or `none` when x is outside the path's range.\n * @since 2.0.0\n */\n <T extends MonotonicX>(p: LinearPath2d<T>, x: number): Solution.AtMostOne<number>\n /** @since 2.0.0 */\n (x: number): <T extends MonotonicX>(p: LinearPath2d<T>) => Solution.AtMostOne<number>\n} = internal.solveAtX as never\n\nexport const solveAtY: {\n /**\n * Evaluates the path's x value at a given y. Requires the path to carry the\n * `MonotonicY` brand. Returns `Solution.none` when y is outside the path's\n * y-range.\n *\n * @param p - A path branded `MonotonicY`.\n * @param y - The y coordinate.\n * @returns The x value at y, or `none` when y is outside the path's range.\n * @since 2.0.0\n */\n <T extends MonotonicY>(p: LinearPath2d<T>, y: number): Solution.AtMostOne<number>\n /** @since 2.0.0 */\n (y: number): <T extends MonotonicY>(p: LinearPath2d<T>) => Solution.AtMostOne<number>\n} = internal.solveAtY as never\n\n/**\n * Computes the axis-aligned bounding box of the path — the smallest closed\n * `Box2d` enclosing every segment.\n *\n * @param p - The linear path.\n * @returns A closed `Box2d` enclosing the path.\n * @since 2.0.0\n */\nexport const boundingBox: (p: LinearPath2d) => Interval2d<Closed, Closed> = internal.boundingBox\n\nexport const transform: {\n /**\n * Applies an `Affine2d` transform to every curve in a `LinearPath2d`,\n * returning a new path whose image is the affine image of the original.\n * Trait brands are dropped — affine maps can flip the sense of monotonicity\n * (a reflection turns `IncreasingX` into `DecreasingX`), so any brands the\n * caller still wants must be reasserted on the result.\n *\n * @param p - The linear path.\n * @param a - The affine transform.\n * @returns A new unbranded `LinearPath2d` whose curves are the affine images of the input's.\n * @since 2.0.0\n */\n (p: LinearPath2d, a: Affine2d): LinearPath2d\n /**\n * Applies an `Affine2d` transform to every curve in a `LinearPath2d`.\n *\n * @param a - The affine transform.\n * @returns A function that takes a `LinearPath2d` and returns the transformed path.\n * @since 2.0.0\n */\n (a: Affine2d): (p: LinearPath2d) => LinearPath2d\n} = internal.transform\n","import * as CubicCurve2d from '../curve/cubic2d.ts'\nimport * as cubicCurveInternal from '../curve/cubic2d.internal.ts'\nimport * as QuadraticCurve2d from '../curve/quadratic2d.ts'\nimport * as Interval from '../interval/interval.ts'\nimport type { Closed } from '../interval/interval.ts'\nimport type { Interval2d } from '../interval/interval2d.ts'\nimport { RELATIVE_TOLERANCE } from '../number.ts'\nimport { dual, invariant } from '../utils.ts'\nimport * as Vector2 from '../vector/vector2.ts'\nimport type { CubicPath2d } from './cubic2d.ts'\nimport * as Path2d from './path2d.ts'\nimport {\n type Continuous,\n type DecreasingX,\n type DecreasingY,\n type IncreasingX,\n type IncreasingY,\n type MonotonicX,\n type MonotonicY,\n} from './traits.ts'\n\nexport const CubicPath2dTypeId: unique symbol = Symbol('curvy/path/cubic2d')\nexport type CubicPath2dTypeId = typeof CubicPath2dTypeId\n\n// Generic operation surface, built once for CubicCurve2d's Ops.\nconst methods = Path2d.makeMethods(CubicPath2dTypeId, cubicCurveInternal.Ops)\n\n/** @internal */\nexport const isCubicPath2d = (p: unknown): p is CubicPath2d =>\n typeof p === 'object' && p !== null && CubicPath2dTypeId in p\n\n// The cubic path enforces a non-empty curve list. Wrap the generic factories\n// to check the invariant; the generic builders accept empty arrays as a\n// matter of structural minimality, but the cubic-specific contract is stricter.\n/** @internal */\nexport const make = (...curves: ReadonlyArray<CubicCurve2d.CubicCurve2d>): CubicPath2d => {\n invariant(curves.length > 0, 'cubic path requires at least one curve')\n return methods.make(...curves) as CubicPath2d\n}\n\n/** @internal */\nexport const fromArray = (curves: ReadonlyArray<CubicCurve2d.CubicCurve2d>): CubicPath2d => {\n invariant(curves.length > 0, 'cubic path requires at least one curve')\n return methods.fromArray(curves) as CubicPath2d\n}\n\n/** @internal */\nexport const append = methods.append as never\n\n/** @internal */\nexport const length = methods.length as (p: CubicPath2d) => number\n\n/** @internal */\nexport const solve = methods.solve as never\n\n/** @internal */\nexport const toPathData = methods.toPathData as (p: CubicPath2d) => string\n\n/** @internal */\nexport const isContinuous = methods.isContinuous as unknown as <T>(\n p: CubicPath2d<T>,\n) => p is CubicPath2d<T & Continuous>\n\n/** @internal */\nexport const asContinuous = <T>(p: CubicPath2d<T>): CubicPath2d<T & Continuous> => {\n invariant(isContinuous(p), 'cubic path is not continuous')\n return p\n}\n\n/** @internal */\nexport const isIncreasingX = methods.isIncreasingX as unknown as <T>(\n p: CubicPath2d<T>,\n) => p is CubicPath2d<T & IncreasingX>\n\n/** @internal */\nexport const isDecreasingX = methods.isDecreasingX as unknown as <T>(\n p: CubicPath2d<T>,\n) => p is CubicPath2d<T & DecreasingX>\n\n/** @internal */\nexport const isMonotonicX = methods.isMonotonicX as unknown as <T>(\n p: CubicPath2d<T>,\n) => p is CubicPath2d<T & MonotonicX>\n\n/** @internal */\nexport const isIncreasingY = methods.isIncreasingY as unknown as <T>(\n p: CubicPath2d<T>,\n) => p is CubicPath2d<T & IncreasingY>\n\n/** @internal */\nexport const isDecreasingY = methods.isDecreasingY as unknown as <T>(\n p: CubicPath2d<T>,\n) => p is CubicPath2d<T & DecreasingY>\n\n/** @internal */\nexport const isMonotonicY = methods.isMonotonicY as unknown as <T>(\n p: CubicPath2d<T>,\n) => p is CubicPath2d<T & MonotonicY>\n\n/** @internal */\nexport const asIncreasingX = <T>(p: CubicPath2d<T>): CubicPath2d<T & IncreasingX> => {\n invariant(isIncreasingX(p), 'cubic path is not increasing in x')\n return p\n}\n\n/** @internal */\nexport const asDecreasingX = <T>(p: CubicPath2d<T>): CubicPath2d<T & DecreasingX> => {\n invariant(isDecreasingX(p), 'cubic path is not decreasing in x')\n return p\n}\n\n/** @internal */\nexport const asMonotonicX = <T>(p: CubicPath2d<T>): CubicPath2d<T & MonotonicX> => {\n invariant(isMonotonicX(p), 'cubic path is not monotonic in x')\n return p\n}\n\n/** @internal */\nexport const asIncreasingY = <T>(p: CubicPath2d<T>): CubicPath2d<T & IncreasingY> => {\n invariant(isIncreasingY(p), 'cubic path is not increasing in y')\n return p\n}\n\n/** @internal */\nexport const asDecreasingY = <T>(p: CubicPath2d<T>): CubicPath2d<T & DecreasingY> => {\n invariant(isDecreasingY(p), 'cubic path is not decreasing in y')\n return p\n}\n\n/** @internal */\nexport const asMonotonicY = <T>(p: CubicPath2d<T>): CubicPath2d<T & MonotonicY> => {\n invariant(isMonotonicY(p), 'cubic path is not monotonic in y')\n return p\n}\n\n/** @internal */\nexport const solveAtX = methods.solveAtX as never\n\n/** @internal */\nexport const solveAtY = methods.solveAtY as never\n\n/** @internal */\nexport const boundingBox = methods.boundingBox as (p: CubicPath2d) => Interval2d<Closed, Closed>\n\n/** @internal */\nexport const transform = methods.transform as never\n\n// Cubic-specific arc-length sampling. Cached by path identity since paths are\n// immutable. Lives here rather than in the generic Path2d because the inner\n// Newton iteration uses the cubic-curve derivative directly.\n\n// Cumulative segment lengths cache. lengths[k] = total length through segment k.\nconst cumulativeLengthCache = new WeakMap<CubicPath2d, ReadonlyArray<number>>()\n\nconst getCumulativeLengths = (p: CubicPath2d): ReadonlyArray<number> => {\n let cached = cumulativeLengthCache.get(p)\n if (cached === undefined) {\n const lengths: Array<number> = []\n let total = 0\n for (const curve of p) {\n total += CubicCurve2d.length(curve, Interval.unit)\n lengths.push(total)\n }\n cached = lengths\n cumulativeLengthCache.set(p, cached)\n }\n return cached\n}\n\n// Newton's method to find the local parameter t ∈ [0, 1] within `curve` such\n// that the arc length from 0 to t equals `target`. Each iteration costs one\n// GL32 quadrature plus one velocity eval; converges in 3–5 iterations for\n// well-behaved curves. Falls back to bisection on cusps where speed → 0.\nconst solveCurveByDistance = (\n curve: CubicCurve2d.CubicCurve2d,\n target: number,\n segmentLength: number,\n): number => {\n if (target <= 0) {\n return 0\n }\n if (target >= segmentLength) {\n return 1\n }\n\n const derivative = cubicCurveInternal.derivative(curve)\n\n let t = target / segmentLength\n let lo = 0\n let hi = 1\n\n for (let iter = 0; iter < 16; iter++) {\n const currentLength = CubicCurve2d.length(curve, Interval.make(0, t))\n const error = currentLength - target\n\n // Converged when the remaining arc-length error reaches the noise floor\n // relative to the segment. An absolute criterion demands unreachable\n // precision on long segments (burning every iteration) and stops a step\n // early on short ones.\n if (Math.abs(error) <= RELATIVE_TOLERANCE * segmentLength) {\n return t\n }\n\n if (error > 0) {\n hi = t\n } else {\n lo = t\n }\n\n const speed = Vector2.magnitude(QuadraticCurve2d.solve(derivative, t))\n if (speed === 0) {\n // cusp — bisect instead\n t = (lo + hi) / 2\n continue\n }\n\n const next = t - error / speed\n // bracket-clamp Newton step; if it leaves the bracket, fall back to bisection\n t = next > lo && next < hi ? next : (lo + hi) / 2\n }\n\n return t\n}\n\n/** @internal */\nexport const solveByDistance = dual<\n (s: number) => (p: CubicPath2d) => Vector2.Vector2,\n (p: CubicPath2d, s: number) => Vector2.Vector2\n>(2, (p: CubicPath2d, s: number) => {\n if (s <= 0) {\n return methods.solve(p, 0)\n }\n if (s >= 1) {\n return methods.solve(p, 1)\n }\n\n const lengths = getCumulativeLengths(p)\n const total = lengths[lengths.length - 1] as number\n const target = s * total\n\n // find segment k such that lengths[k-1] ≤ target ≤ lengths[k]\n let k = 0\n while (k < lengths.length - 1 && (lengths[k] as number) < target) {\n k++\n }\n\n const segmentStart = k === 0 ? 0 : (lengths[k - 1] as number)\n const segmentEnd = lengths[k] as number\n const segmentLength = segmentEnd - segmentStart\n const segmentTarget = target - segmentStart\n\n const curves =\n p instanceof Path2d.Path2dImpl ? (p.curves as ReadonlyArray<CubicCurve2d.CubicCurve2d>) : [...p]\n const curve = curves[k] as CubicCurve2d.CubicCurve2d\n const localT = solveCurveByDistance(curve, segmentTarget, segmentLength)\n\n return CubicCurve2d.solve(curve, localT)\n})\n","import type { Interval2d } from '../interval/interval2d.ts'\nimport type { CubicCurve2d } from '../curve/cubic2d.ts'\nimport type { Closed } from '../interval/interval.ts'\nimport type * as Solution from '../solution/solution.ts'\nimport type { Affine2d } from '../transform/affine2d.ts'\nimport type { Pipeable } from '../utils.ts'\nimport type { Vector2 } from '../vector/vector2.ts'\nimport type { CubicPath2dTypeId } from './cubic2d.internal.ts'\nimport * as internal from './cubic2d.internal.ts'\nimport type {\n Continuous,\n DecreasingX,\n DecreasingY,\n IncreasingX,\n IncreasingY,\n MonotonicX,\n MonotonicY,\n PathTraits,\n} from './traits.ts'\n\nexport type {\n Continuous,\n DecreasingX,\n DecreasingY,\n IncreasingX,\n IncreasingY,\n MonotonicX,\n MonotonicY,\n} from './traits.ts'\n\n/**\n * A cubic path in 2D space.\n *\n * All fields are readonly and immutable, and all operations create new instances.\n *\n * The `Trait` type parameter accumulates trait brands as the path is refined\n * via `isContinuous` / `asContinuous`.\n *\n * @since 1.0.0\n */\nexport interface CubicPath2d<out Trait = unknown> extends Pipeable, Iterable<CubicCurve2d> {\n readonly [CubicPath2dTypeId]: CubicPath2dTypeId\n readonly [PathTraits]: Trait\n}\n\n/**\n * Creates a new `CubicPath2d` instance from a sequence of curves.\n *\n * @param curves - The curves to create the path from.\n * @returns A new `CubicPath2d` instance.\n * @since 2.0.0\n */\nexport const make: (...curves: ReadonlyArray<CubicCurve2d>) => CubicPath2d = internal.make\n\n/**\n * Creates a new `CubicPath2d` instance from an array of curves.\n *\n * @param curves - The curves to create the path from.\n * @returns A new `CubicPath2d` instance.\n * @since 2.0.0\n */\nexport const fromArray: (curves: ReadonlyArray<CubicCurve2d>) => CubicPath2d = internal.fromArray\n\n/**\n * Checks if a value is a `CubicPath2d`.\n *\n * @param p - The value to check.\n * @returns `true` if the value is a `CubicPath2d`, `false` otherwise.\n * @since 1.0.0\n */\nexport const isCubicPath2d: (p: unknown) => p is CubicPath2d = internal.isCubicPath2d\n\nexport const append: {\n /**\n * Appends a cubic curve to a cubic path.\n *\n * @param c - The cubic curve to append.\n * @returns A function that takes a cubic path and returns a new cubic path.\n * @since 1.0.0\n */\n (c: CubicCurve2d): (p: CubicPath2d) => CubicPath2d\n /**\n * Appends a cubic curve to a cubic path.\n *\n * @param p - The cubic path to append to.\n * @param c - The cubic curve to append.\n * @returns A new cubic path.\n * @since 1.0.0\n */\n (p: CubicPath2d, c: CubicCurve2d): CubicPath2d\n} = internal.append\n\n/**\n * Calculates the length of a cubic path.\n *\n * @param p - The cubic path to calculate the length of.\n * @returns The length of the cubic path.\n * @since 1.0.0\n */\nexport const length: (p: CubicPath2d) => number = internal.length\n\nexport const solve: {\n /**\n * Solves a cubic path for a given parameter.\n *\n * @param u - The parameter to solve for.\n * @returns A function that takes a cubic path and returns the solved vector.\n * @since 1.0.0\n */\n (u: number): (p: CubicPath2d) => Vector2\n /**\n * Solves a cubic path for a given parameter.\n *\n * @param p - The cubic path to solve.\n * @param u - The parameter to solve for.\n * @returns The solved vector.\n * @since 1.0.0\n */\n (p: CubicPath2d, u: number): Vector2\n} = internal.solve\n\n/**\n * Serializes a cubic path as an SVG path data string (the value of a `<path>`\n * element's `d` attribute), using `M` and `C` commands. Discontinuities between\n * curves emit a fresh `M` command.\n *\n * @param p - The cubic path to serialize.\n * @returns The SVG path data string.\n * @since 2.0.0\n */\nexport const toPathData: (p: CubicPath2d) => string = internal.toPathData\n\n/**\n * Type-narrowing predicate: refines `CubicPath2d<T>` to\n * `CubicPath2d<T & Continuous>` when adjacent curves connect.\n *\n * @since 2.0.0\n */\nexport const isContinuous: <T>(p: CubicPath2d<T>) => p is CubicPath2d<T & Continuous> =\n internal.isContinuous\n\n/**\n * Asserts that the cubic path is continuous, throwing on failure.\n *\n * @since 2.0.0\n */\nexport const asContinuous: <T>(p: CubicPath2d<T>) => CubicPath2d<T & Continuous> =\n internal.asContinuous\n\n/**\n * Type-narrowing predicate: refines `CubicPath2d<T>` to\n * `CubicPath2d<T & IncreasingX>` when every segment's x-polynomial is\n * strictly increasing on `[0, 1]` and adjacent segments' x-ranges don't\n * overlap.\n *\n * @since 2.0.0\n */\nexport const isIncreasingX: <T>(p: CubicPath2d<T>) => p is CubicPath2d<T & IncreasingX> =\n internal.isIncreasingX\n\n/**\n * Type-narrowing predicate: refines `CubicPath2d<T>` to\n * `CubicPath2d<T & DecreasingX>`.\n *\n * @since 2.0.0\n */\nexport const isDecreasingX: <T>(p: CubicPath2d<T>) => p is CubicPath2d<T & DecreasingX> =\n internal.isDecreasingX\n\n/**\n * Type-narrowing predicate: refines `CubicPath2d<T>` to\n * `CubicPath2d<T & MonotonicX>`.\n *\n * @since 2.0.0\n */\nexport const isMonotonicX: <T>(p: CubicPath2d<T>) => p is CubicPath2d<T & MonotonicX> =\n internal.isMonotonicX\n\n/**\n * Type-narrowing predicate: refines `CubicPath2d<T>` to\n * `CubicPath2d<T & IncreasingY>`.\n *\n * @since 2.0.0\n */\nexport const isIncreasingY: <T>(p: CubicPath2d<T>) => p is CubicPath2d<T & IncreasingY> =\n internal.isIncreasingY\n\n/**\n * Type-narrowing predicate: refines `CubicPath2d<T>` to\n * `CubicPath2d<T & DecreasingY>`.\n *\n * @since 2.0.0\n */\nexport const isDecreasingY: <T>(p: CubicPath2d<T>) => p is CubicPath2d<T & DecreasingY> =\n internal.isDecreasingY\n\n/**\n * Type-narrowing predicate: refines `CubicPath2d<T>` to\n * `CubicPath2d<T & MonotonicY>`.\n *\n * @since 2.0.0\n */\nexport const isMonotonicY: <T>(p: CubicPath2d<T>) => p is CubicPath2d<T & MonotonicY> =\n internal.isMonotonicY\n\n/**\n * Asserts that the path is strictly increasing in x, throwing on failure.\n *\n * @since 2.0.0\n */\nexport const asIncreasingX: <T>(p: CubicPath2d<T>) => CubicPath2d<T & IncreasingX> =\n internal.asIncreasingX\n\n/**\n * Asserts that the path is strictly decreasing in x, throwing on failure.\n *\n * @since 2.0.0\n */\nexport const asDecreasingX: <T>(p: CubicPath2d<T>) => CubicPath2d<T & DecreasingX> =\n internal.asDecreasingX\n\n/**\n * Asserts that the path is monotonic in x, throwing on failure.\n *\n * @since 2.0.0\n */\nexport const asMonotonicX: <T>(p: CubicPath2d<T>) => CubicPath2d<T & MonotonicX> =\n internal.asMonotonicX\n\n/**\n * Asserts that the path is strictly increasing in y, throwing on failure.\n *\n * @since 2.0.0\n */\nexport const asIncreasingY: <T>(p: CubicPath2d<T>) => CubicPath2d<T & IncreasingY> =\n internal.asIncreasingY\n\n/**\n * Asserts that the path is strictly decreasing in y, throwing on failure.\n *\n * @since 2.0.0\n */\nexport const asDecreasingY: <T>(p: CubicPath2d<T>) => CubicPath2d<T & DecreasingY> =\n internal.asDecreasingY\n\n/**\n * Asserts that the path is monotonic in y, throwing on failure.\n *\n * @since 2.0.0\n */\nexport const asMonotonicY: <T>(p: CubicPath2d<T>) => CubicPath2d<T & MonotonicY> =\n internal.asMonotonicY\n\nexport const solveAtX: {\n /**\n * Evaluates the path's y value at a given x. Requires the path to carry\n * the `MonotonicX` brand. Returns `Solution.none` when x is outside the\n * path's x-range.\n *\n * @param p - A path branded `MonotonicX`.\n * @param x - The x coordinate.\n * @returns The y value at x, or `none` when x is outside the path's range.\n * @since 2.0.0\n */\n <T extends MonotonicX>(p: CubicPath2d<T>, x: number): Solution.AtMostOne<number>\n /** @since 2.0.0 */\n (x: number): <T extends MonotonicX>(p: CubicPath2d<T>) => Solution.AtMostOne<number>\n} = internal.solveAtX as never\n\nexport const solveAtY: {\n /**\n * Evaluates the path's x value at a given y. Requires the path to carry\n * the `MonotonicY` brand. Returns `Solution.none` when y is outside the\n * path's y-range.\n *\n * @param p - A path branded `MonotonicY`.\n * @param y - The y coordinate.\n * @returns The x value at y, or `none` when y is outside the path's range.\n * @since 2.0.0\n */\n <T extends MonotonicY>(p: CubicPath2d<T>, y: number): Solution.AtMostOne<number>\n /** @since 2.0.0 */\n (y: number): <T extends MonotonicY>(p: CubicPath2d<T>) => Solution.AtMostOne<number>\n} = internal.solveAtY as never\n\nexport const solveByDistance: {\n /**\n * Solves a cubic path by normalized arc length. Unlike {@link solve}, which\n * is parameterized by curve `u`, this samples points at constant speed along\n * the path — `s = 0.5` returns the point exactly halfway along the curve by\n * arc length, regardless of how the underlying parameterization stretches.\n *\n * Cumulative segment lengths are cached by path identity so repeated calls\n * with the same path are fast.\n *\n * @param p - The cubic path to sample.\n * @param s - Normalized arc length in `[0, 1]`. Values outside the range are\n * clamped to path endpoints.\n * @returns The point on the path at the given normalized arc length.\n * @since 1.1.0\n */\n (p: CubicPath2d, s: number): Vector2\n /**\n * Solves a cubic path by normalized arc length.\n *\n * @param s - Normalized arc length in `[0, 1]`.\n * @returns A function that takes a cubic path and returns the point at that\n * arc length.\n * @since 1.1.0\n */\n (s: number): (p: CubicPath2d) => Vector2\n} = internal.solveByDistance\n\n/**\n * Computes the axis-aligned bounding box of the path — the smallest closed\n * `Box2d` enclosing every segment.\n *\n * @param p - The cubic path.\n * @returns A closed `Box2d` enclosing the path.\n * @since 2.0.0\n */\nexport const boundingBox: (p: CubicPath2d) => Interval2d<Closed, Closed> = internal.boundingBox\n\nexport const transform: {\n /**\n * Applies an `Affine2d` transform to every curve in a `CubicPath2d`,\n * returning a new path whose image is the affine image of the original.\n * Trait brands are dropped.\n *\n * @param p - The cubic path.\n * @param a - The affine transform.\n * @returns A new unbranded `CubicPath2d` whose curves are the affine images of the input's.\n * @since 2.0.0\n */\n (p: CubicPath2d, a: Affine2d): CubicPath2d\n /**\n * Applies an `Affine2d` transform to every curve in a `CubicPath2d`.\n *\n * @param a - The affine transform.\n * @returns A function that takes a `CubicPath2d` and returns the transformed path.\n * @since 2.0.0\n */\n (a: Affine2d): (p: CubicPath2d) => CubicPath2d\n} = internal.transform\n","import type * as CubicCurve2d from '../curve/cubic2d.ts'\nimport * as RationalCubicCurve2d from '../curve/rationalCubic2d.ts'\nimport type * as Interval from '../interval/interval.ts'\nimport * as Interval2d from '../interval/interval2d.ts'\nimport type * as Affine2d from '../transform/affine2d.ts'\nimport { dual, Pipeable } from '../utils.ts'\nimport { invariant } from '../utils.ts'\nimport type * as Vector2 from '../vector/vector2.ts'\nimport * as CubicPath2d from './cubic2d.ts'\nimport type { RationalCubicPath2d } from './rationalCubic2d.ts'\n\nexport const RationalCubicPath2dTypeId: unique symbol = Symbol('curvy/path/rationalCubic2d')\nexport type RationalCubicPath2dTypeId = typeof RationalCubicPath2dTypeId\n\n/** @internal */\nexport class RationalCubicPath2dImpl extends Pipeable implements RationalCubicPath2d {\n readonly [RationalCubicPath2dTypeId]: RationalCubicPath2dTypeId = RationalCubicPath2dTypeId\n\n readonly curves: ReadonlyArray<RationalCubicCurve2d.RationalCubicCurve2d>\n\n constructor(curves: ReadonlyArray<RationalCubicCurve2d.RationalCubicCurve2d>) {\n invariant(curves.length > 0, 'rational cubic path requires at least one curve')\n super()\n this.curves = curves\n }\n\n [Symbol.iterator](): Iterator<RationalCubicCurve2d.RationalCubicCurve2d> {\n return this.curves[Symbol.iterator]()\n }\n}\n\n/** @internal */\nexport const isRationalCubicPath2d = (p: unknown): p is RationalCubicPath2d =>\n typeof p === 'object' && p !== null && RationalCubicPath2dTypeId in p\n\n/** @internal */\nexport const make = (\n ...curves: ReadonlyArray<RationalCubicCurve2d.RationalCubicCurve2d>\n): RationalCubicPath2d => new RationalCubicPath2dImpl(curves)\n\n/** @internal */\nexport const fromArray = (\n curves: ReadonlyArray<RationalCubicCurve2d.RationalCubicCurve2d>,\n): RationalCubicPath2d => new RationalCubicPath2dImpl(curves)\n\n/** @internal */\nexport const append = dual<\n (c: RationalCubicCurve2d.RationalCubicCurve2d) => (p: RationalCubicPath2d) => RationalCubicPath2d,\n (p: RationalCubicPath2d, c: RationalCubicCurve2d.RationalCubicCurve2d) => RationalCubicPath2d\n>(2, (p, c) => fromArray([...p, c]))\n\n/** @internal */\nexport const solve = dual<\n (u: number) => (p: RationalCubicPath2d) => Vector2.Vector2,\n (p: RationalCubicPath2d, u: number) => Vector2.Vector2\n>(2, (p: RationalCubicPath2d, u: number) => {\n const curves = p instanceof RationalCubicPath2dImpl ? p.curves : [...p]\n\n if (u === 1) {\n const last = curves.at(-1) as RationalCubicCurve2d.RationalCubicCurve2d\n return RationalCubicCurve2d.solve(last, 1)\n }\n\n const t = u * curves.length\n const i = Math.floor(t)\n const curve = curves[i] as RationalCubicCurve2d.RationalCubicCurve2d\n return RationalCubicCurve2d.solve(curve, t - i)\n})\n\n// Path-level bounding box: per-segment box is delegated to the curve module\n// (subdivision + hull union, tight to within `tolerance` per side); the path\n// box is then their union. Since each segment box's slack is ≤ tolerance per\n// side, the unioned box's slack is also ≤ tolerance per side — the same\n// guarantee holds at the path level.\n/** @internal */\nexport const boundingBox = dual<\n (\n tolerance: number,\n ) => (p: RationalCubicPath2d) => Interval2d.Interval2d<Interval.Closed, Interval.Closed>,\n (\n p: RationalCubicPath2d,\n tolerance: number,\n ) => Interval2d.Interval2d<Interval.Closed, Interval.Closed>\n>(2, (p: RationalCubicPath2d, tolerance: number) => {\n const iter = p[Symbol.iterator]()\n const first = iter.next()\n let acc = RationalCubicCurve2d.boundingBox(\n first.value as RationalCubicCurve2d.RationalCubicCurve2d,\n tolerance,\n )\n for (let next = iter.next(); !next.done; next = iter.next()) {\n acc = Interval2d.union(acc, RationalCubicCurve2d.boundingBox(next.value, tolerance))\n }\n return acc\n})\n\n// Path-level approximation: per-segment approximation is delegated to the\n// curve module; we just concat the results. Segment count grows from N\n// (input) to roughly N × k where k depends on weight magnitude and tolerance —\n// uniform-weight segments stay 1:1.\n/** @internal */\nexport const approximateAsCubicPath = dual<\n (tolerance: number) => (p: RationalCubicPath2d) => CubicPath2d.CubicPath2d,\n (p: RationalCubicPath2d, tolerance: number) => CubicPath2d.CubicPath2d\n>(2, (p: RationalCubicPath2d, tolerance: number) => {\n const curves: Array<CubicCurve2d.CubicCurve2d> = []\n for (const segment of p) {\n for (const approx of RationalCubicCurve2d.approximateAsCubicCurves(segment, tolerance)) {\n curves.push(approx)\n }\n }\n return CubicPath2d.fromArray(curves)\n})\n\n/** @internal */\nexport const transform = dual<\n (a: Affine2d.Affine2d) => (p: RationalCubicPath2d) => RationalCubicPath2d,\n (p: RationalCubicPath2d, a: Affine2d.Affine2d) => RationalCubicPath2d\n>(2, (p: RationalCubicPath2d, a: Affine2d.Affine2d) => {\n const curves: Array<RationalCubicCurve2d.RationalCubicCurve2d> = []\n for (const segment of p) {\n curves.push(RationalCubicCurve2d.transform(segment, a))\n }\n return fromArray(curves)\n})\n","import type { RationalCubicCurve2d } from '../curve/rationalCubic2d.ts'\nimport type { Closed } from '../interval/interval.ts'\nimport type { Interval2d } from '../interval/interval2d.ts'\nimport type { Affine2d } from '../transform/affine2d.ts'\nimport type { Pipeable } from '../utils.ts'\nimport type { Vector2 } from '../vector/vector2.ts'\nimport type { CubicPath2d } from './cubic2d.ts'\nimport type { RationalCubicPath2dTypeId } from './rationalCubic2d.internal.ts'\nimport * as internal from './rationalCubic2d.internal.ts'\n\n/**\n * A rational cubic path in 2D space.\n *\n * Holds a non-empty sequence of `RationalCubicCurve2d` segments; iteration\n * yields the segments in order. The path parameter `u ∈ [0, 1]` is mapped\n * uniformly across segments — `u = 0` is the start of the first segment,\n * `u = 1` is the end of the last segment, and intermediate values pick a\n * segment by index and a local parameter within it.\n *\n * Counterpart to `CubicPath2d` for curves whose evaluation includes the\n * homogeneous-to-plane projection.\n *\n * All fields are readonly and immutable, and all operations create new instances.\n *\n * @since 2.0.0\n */\nexport interface RationalCubicPath2d extends Pipeable, Iterable<RationalCubicCurve2d> {\n readonly [RationalCubicPath2dTypeId]: RationalCubicPath2dTypeId\n}\n\n/**\n * Checks if a value is a `RationalCubicPath2d`.\n *\n * @param p - The value to check.\n * @returns `true` if the value is a `RationalCubicPath2d`, `false` otherwise.\n * @since 2.0.0\n */\nexport const isRationalCubicPath2d: (p: unknown) => p is RationalCubicPath2d =\n internal.isRationalCubicPath2d\n\n/**\n * Creates a new `RationalCubicPath2d` from a sequence of curves.\n *\n * @param curves - The curves to create the path from.\n * @returns A new `RationalCubicPath2d` instance.\n * @since 2.0.0\n */\nexport const make: (...curves: ReadonlyArray<RationalCubicCurve2d>) => RationalCubicPath2d =\n internal.make\n\n/**\n * Creates a new `RationalCubicPath2d` from an array of curves.\n *\n * @param curves - The curves to create the path from.\n * @returns A new `RationalCubicPath2d` instance.\n * @since 2.0.0\n */\nexport const fromArray: (curves: ReadonlyArray<RationalCubicCurve2d>) => RationalCubicPath2d =\n internal.fromArray\n\nexport const append: {\n /**\n * Appends a curve to a `RationalCubicPath2d`.\n *\n * @param c - The curve to append.\n * @returns A function that takes a path and returns a new path with the appended curve.\n * @since 2.0.0\n */\n (c: RationalCubicCurve2d): (p: RationalCubicPath2d) => RationalCubicPath2d\n /**\n * Appends a curve to a `RationalCubicPath2d`.\n *\n * @param p - The path to append to.\n * @param c - The curve to append.\n * @returns A new path with the appended curve.\n * @since 2.0.0\n */\n (p: RationalCubicPath2d, c: RationalCubicCurve2d): RationalCubicPath2d\n} = internal.append\n\nexport const solve: {\n /**\n * Evaluates the rational cubic path at parameter `u ∈ [0, 1]`.\n *\n * Picks the segment containing `u` (uniform mapping across segments) and\n * delegates to `RationalCubicCurve2d.solve` on that segment with the local\n * parameter.\n *\n * @param p - The path to evaluate.\n * @param u - The path parameter in `[0, 1]`.\n * @returns The point on the path at parameter `u`.\n * @since 2.0.0\n */\n (p: RationalCubicPath2d, u: number): Vector2\n /**\n * Evaluates the rational cubic path at parameter `u ∈ [0, 1]`.\n *\n * @param u - The path parameter in `[0, 1]`.\n * @returns A function that takes a path and returns the point at `u`.\n * @since 2.0.0\n */\n (u: number): (p: RationalCubicPath2d) => Vector2\n} = internal.solve\n\nexport const boundingBox: {\n /**\n * Computes a closed axis-aligned bounding box for a rational cubic path,\n * tight to within `tolerance` per side.\n *\n * Per-segment delegates to `RationalCubicCurve2d.boundingBox(c, tolerance)`\n * — recursive subdivision producing a hull-AABB union tight to within\n * `tolerance` per side. The path box is the union of segment boxes; since\n * each segment box has slack ≤ tolerance per side, so does the union.\n *\n * @param p - The rational cubic path.\n * @param tolerance - Maximum allowed slack per side; must be positive.\n * @returns A closed `Interval2d` enclosing the path, tight to within `tolerance`.\n * @since 2.0.0\n */\n (p: RationalCubicPath2d, tolerance: number): Interval2d<Closed, Closed>\n /**\n * Computes a closed axis-aligned bounding box for a rational cubic path.\n *\n * @param tolerance - Maximum allowed slack per side; must be positive.\n * @returns A function that takes a path and returns its bounding box.\n * @since 2.0.0\n */\n (tolerance: number): (p: RationalCubicPath2d) => Interval2d<Closed, Closed>\n} = internal.boundingBox\n\nexport const approximateAsCubicPath: {\n /**\n * Approximates the rational cubic path as a `CubicPath2d` via per-segment\n * recursive subdivision. Each input segment is split until its midpoint\n * deviates from a polynomial-cubic candidate by at most `tolerance`; the\n * surviving candidates are concatenated into a new path.\n *\n * Lossy in general — only exact when every input segment has uniform\n * weights, in which case segment count is preserved. Tighter tolerance\n * produces more segments.\n *\n * @param p - The rational cubic path to approximate.\n * @param tolerance - Maximum allowed midpoint deviation per segment; must be positive.\n * @returns A new `CubicPath2d` approximating the input.\n * @since 2.0.0\n */\n (p: RationalCubicPath2d, tolerance: number): CubicPath2d\n /**\n * Approximates the rational cubic path as a `CubicPath2d`.\n *\n * @param tolerance - Maximum allowed midpoint deviation per segment; must be positive.\n * @returns A function that takes a rational path and returns its approximation.\n * @since 2.0.0\n */\n (tolerance: number): (p: RationalCubicPath2d) => CubicPath2d\n} = internal.approximateAsCubicPath\n\nexport const transform: {\n /**\n * Applies an `Affine2d` transform to every curve in a `RationalCubicPath2d`,\n * returning a new path whose image is the affine image of the original.\n *\n * @param p - The rational cubic path.\n * @param a - The affine transform.\n * @returns A new `RationalCubicPath2d` whose curves are the affine images of the input's.\n * @since 2.0.0\n */\n (p: RationalCubicPath2d, a: Affine2d): RationalCubicPath2d\n /**\n * Applies an `Affine2d` transform to every curve in a `RationalCubicPath2d`.\n *\n * @param a - The affine transform.\n * @returns A function that takes a `RationalCubicPath2d` and returns the transformed path.\n * @since 2.0.0\n */\n (a: Affine2d): (p: RationalCubicPath2d) => RationalCubicPath2d\n} = internal.transform\n"],"mappings":";;;;;;;;;;;;;;;;;AA4CA,IAAa,aAAb,cAAmC,SAAuC;CAExE;CAEA,YAAY,QAAgB,QAA0B;EACpD,OAAO;EACN,KAA4C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AAK,IAAI,OAAO,KAAK,MAAM,EAAE,CAAC,KAAK,MAAM,OAAO,KAAK,MAAM,EACzD,MAAMC,MAAiB,KAAKD,cAAiC,KAAK,OAAO,UAAU,CAAC;CAEtF,OAAO;EACP;;AAOF,MAAaE,2BAAyB,KAGpC,IAAI,GAAwB,cAAsB;CAClD,MAAM,SAA2C,EAAE;CACnD,KAAK,MAAM,WAAW,GACpB,KAAK,MAAM,UAAUC,yBAA8C,SAAS,UAAU,EACpF,OAAO,KAAK,OAAO;CAGvB,OAAOC,YAAsB,OAAO;EACpC;;AAGF,MAAaC,cAAY,KAGvB,IAAI,GAAwB,MAAyB;CACrD,MAAM,SAA2D,EAAE;CACnE,KAAK,MAAM,WAAW,GACpB,OAAO,KAAKC,YAA+B,SAAS,EAAE,CAAC;CAEzD,OAAOX,YAAU,OAAO;EACxB;;;;;;;;;;;;;;;;;;;;ACvFF,MAAa,wBACXY;;;;;;;;AASF,MAAa,OACXC;;;;;;;;AASF,MAAa,YACXC;AAEF,MAAa,SAkBTC;AAEJ,MAAa,QAsBTC;AAEJ,MAAa,cAwBTC;AAEJ,MAAa,yBAyBTC;AAEJ,MAAa,YAmBTC"}
|
|
@@ -92,10 +92,29 @@ const transform$7 = dual(2, (c, a) => {
|
|
|
92
92
|
const m = a.matrix;
|
|
93
93
|
return new LinearCurve2dImpl(make$2(m.m00 * c.x.c0 + m.m01 * c.y.c0 + m.m02, m.m00 * c.x.c1 + m.m01 * c.y.c1), make$2(m.m10 * c.x.c0 + m.m11 * c.y.c0 + m.m12, m.m10 * c.x.c1 + m.m11 * c.y.c1));
|
|
94
94
|
});
|
|
95
|
+
/**
|
|
96
|
+
* The `Curve2dOps` bundle consumed by the generic `Path2d` implementation.
|
|
97
|
+
*
|
|
98
|
+
* @internal
|
|
99
|
+
*/
|
|
100
|
+
const Ops$2 = {
|
|
101
|
+
solve: solve$7,
|
|
102
|
+
startPoint: startPoint$7,
|
|
103
|
+
endPoint: endPoint$7,
|
|
104
|
+
length: length$5,
|
|
105
|
+
boundingBox: boundingBox$7,
|
|
106
|
+
solveAtX: solveAtX$7,
|
|
107
|
+
solveAtY: solveAtY$7,
|
|
108
|
+
toPathDataSegment: toPathDataSegment$5,
|
|
109
|
+
isIncreasingX: isIncreasingX$7,
|
|
110
|
+
isDecreasingX: isDecreasingX$7,
|
|
111
|
+
isIncreasingY: isIncreasingY$7,
|
|
112
|
+
isDecreasingY: isDecreasingY$7,
|
|
113
|
+
transform: transform$7
|
|
114
|
+
};
|
|
95
115
|
//#endregion
|
|
96
116
|
//#region src/curve/linear2d.ts
|
|
97
117
|
var linear2d_exports = /* @__PURE__ */ __exportAll({
|
|
98
|
-
Ops: () => Ops$2,
|
|
99
118
|
asDecreasing: () => asDecreasing$6,
|
|
100
119
|
asIncreasing: () => asIncreasing$6,
|
|
101
120
|
asMonotonic: () => asMonotonic$6,
|
|
@@ -319,28 +338,6 @@ const asIncreasing$6 = asIncreasing$7;
|
|
|
319
338
|
*/
|
|
320
339
|
const asDecreasing$6 = asDecreasing$7;
|
|
321
340
|
const transform$6 = transform$7;
|
|
322
|
-
/**
|
|
323
|
-
* The {@link Curve2dOps} bundle for `LinearCurve2d`. Used by
|
|
324
|
-
* `LinearPath2d` (and any user code building a generic `Path2d` over linear
|
|
325
|
-
* curves) to wire up the path-level operation surface.
|
|
326
|
-
*
|
|
327
|
-
* @since 2.0.0
|
|
328
|
-
*/
|
|
329
|
-
const Ops$2 = {
|
|
330
|
-
solve: solve$6,
|
|
331
|
-
startPoint: startPoint$6,
|
|
332
|
-
endPoint: endPoint$6,
|
|
333
|
-
length: length$4,
|
|
334
|
-
boundingBox: boundingBox$6,
|
|
335
|
-
solveAtX: solveAtX$6,
|
|
336
|
-
solveAtY: solveAtY$6,
|
|
337
|
-
toPathDataSegment: toPathDataSegment$4,
|
|
338
|
-
isIncreasingX: isIncreasingX$6,
|
|
339
|
-
isDecreasingX: isDecreasingX$6,
|
|
340
|
-
isIncreasingY: isIncreasingY$6,
|
|
341
|
-
isDecreasingY: isDecreasingY$6,
|
|
342
|
-
transform: transform$6
|
|
343
|
-
};
|
|
344
341
|
//#endregion
|
|
345
342
|
//#region src/curve/quadratic2d.internal.ts
|
|
346
343
|
const QuadraticCurve2dTypeId = Symbol("curvy/curve/quadratic2d");
|
|
@@ -440,10 +437,32 @@ const transform$5 = dual(2, (c, a) => {
|
|
|
440
437
|
const m = a.matrix;
|
|
441
438
|
return new QuadraticCurve2dImpl(make$3(m.m00 * c.x.c0 + m.m01 * c.y.c0 + m.m02, m.m00 * c.x.c1 + m.m01 * c.y.c1, m.m00 * c.x.c2 + m.m01 * c.y.c2), make$3(m.m10 * c.x.c0 + m.m11 * c.y.c0 + m.m12, m.m10 * c.x.c1 + m.m11 * c.y.c1, m.m10 * c.x.c2 + m.m11 * c.y.c2));
|
|
442
439
|
});
|
|
440
|
+
/**
|
|
441
|
+
* The `Curve2dOps` bundle consumed by the generic `Path2d` implementation.
|
|
442
|
+
* `solveAtX` / `solveAtY` narrow the curve's potentially-2-element result to
|
|
443
|
+
* `AtMostOne` — path callers guarantee that via the path's
|
|
444
|
+
* `MonotonicX`/`MonotonicY` brand.
|
|
445
|
+
*
|
|
446
|
+
* @internal
|
|
447
|
+
*/
|
|
448
|
+
const Ops$1 = {
|
|
449
|
+
solve: solve$5,
|
|
450
|
+
startPoint: startPoint$5,
|
|
451
|
+
endPoint: endPoint$5,
|
|
452
|
+
length: length$3,
|
|
453
|
+
boundingBox: boundingBox$5,
|
|
454
|
+
solveAtX: (c, x) => solveAtX$5(c, x),
|
|
455
|
+
solveAtY: (c, y) => solveAtY$5(c, y),
|
|
456
|
+
toPathDataSegment: toPathDataSegment$3,
|
|
457
|
+
isIncreasingX: isIncreasingX$5,
|
|
458
|
+
isDecreasingX: isDecreasingX$5,
|
|
459
|
+
isIncreasingY: isIncreasingY$5,
|
|
460
|
+
isDecreasingY: isDecreasingY$5,
|
|
461
|
+
transform: transform$5
|
|
462
|
+
};
|
|
443
463
|
//#endregion
|
|
444
464
|
//#region src/curve/quadratic2d.ts
|
|
445
465
|
var quadratic2d_exports = /* @__PURE__ */ __exportAll({
|
|
446
|
-
Ops: () => Ops$1,
|
|
447
466
|
asDecreasing: () => asDecreasing$4,
|
|
448
467
|
asIncreasing: () => asIncreasing$4,
|
|
449
468
|
asMonotonic: () => asMonotonic$4,
|
|
@@ -631,30 +650,6 @@ const asIncreasing$4 = asIncreasing$5;
|
|
|
631
650
|
/** @since 2.0.0 */
|
|
632
651
|
const asDecreasing$4 = asDecreasing$5;
|
|
633
652
|
const transform$4 = transform$5;
|
|
634
|
-
/**
|
|
635
|
-
* The {@link Curve2dOps} bundle for `QuadraticCurve2d`. Used by
|
|
636
|
-
* `QuadraticPath2d` to wire up the path-level operation surface. The
|
|
637
|
-
* `solveAtX` / `solveAtY` entries narrow the curve's potentially-2-element
|
|
638
|
-
* result to `AtMostOne` — path callers enforce that via the path's
|
|
639
|
-
* `MonotonicX`/`MonotonicY` brand.
|
|
640
|
-
*
|
|
641
|
-
* @since 2.0.0
|
|
642
|
-
*/
|
|
643
|
-
const Ops$1 = {
|
|
644
|
-
solve: solve$4,
|
|
645
|
-
startPoint: startPoint$4,
|
|
646
|
-
endPoint: endPoint$4,
|
|
647
|
-
length: length$2,
|
|
648
|
-
boundingBox: boundingBox$4,
|
|
649
|
-
solveAtX: (c, x) => solveAtX$5(c, x),
|
|
650
|
-
solveAtY: (c, y) => solveAtY$5(c, y),
|
|
651
|
-
toPathDataSegment: toPathDataSegment$2,
|
|
652
|
-
isIncreasingX: isIncreasingX$4,
|
|
653
|
-
isDecreasingX: isDecreasingX$4,
|
|
654
|
-
isIncreasingY: isIncreasingY$4,
|
|
655
|
-
isDecreasingY: isDecreasingY$4,
|
|
656
|
-
transform: transform$4
|
|
657
|
-
};
|
|
658
653
|
//#endregion
|
|
659
654
|
//#region src/curve/cubic2d.internal.ts
|
|
660
655
|
const CubicCurve2dTypeId = Symbol("curvy/curve/cubic2d");
|
|
@@ -767,10 +762,32 @@ const transform$3 = dual(2, (c, a) => {
|
|
|
767
762
|
const m = a.matrix;
|
|
768
763
|
return new CubicCurve2dImpl(make$1(m.m00 * c.x.c0 + m.m01 * c.y.c0 + m.m02, m.m00 * c.x.c1 + m.m01 * c.y.c1, m.m00 * c.x.c2 + m.m01 * c.y.c2, m.m00 * c.x.c3 + m.m01 * c.y.c3), make$1(m.m10 * c.x.c0 + m.m11 * c.y.c0 + m.m12, m.m10 * c.x.c1 + m.m11 * c.y.c1, m.m10 * c.x.c2 + m.m11 * c.y.c2, m.m10 * c.x.c3 + m.m11 * c.y.c3));
|
|
769
764
|
});
|
|
765
|
+
/**
|
|
766
|
+
* The `Curve2dOps` bundle consumed by the generic `Path2d` implementation.
|
|
767
|
+
* `solveAtX` / `solveAtY` narrow the curve's potentially-3-element result to
|
|
768
|
+
* `AtMostOne` — path callers guarantee that via the path's
|
|
769
|
+
* `MonotonicX`/`MonotonicY` brand.
|
|
770
|
+
*
|
|
771
|
+
* @internal
|
|
772
|
+
*/
|
|
773
|
+
const Ops = {
|
|
774
|
+
solve: solve$3,
|
|
775
|
+
startPoint: startPoint$3,
|
|
776
|
+
endPoint: endPoint$3,
|
|
777
|
+
length: length$1,
|
|
778
|
+
boundingBox: boundingBox$3,
|
|
779
|
+
solveAtX: (c, x) => solveAtX$3(c, x),
|
|
780
|
+
solveAtY: (c, y) => solveAtY$3(c, y),
|
|
781
|
+
toPathDataSegment: toPathDataSegment$1,
|
|
782
|
+
isIncreasingX: isIncreasingX$3,
|
|
783
|
+
isDecreasingX: isDecreasingX$3,
|
|
784
|
+
isIncreasingY: isIncreasingY$3,
|
|
785
|
+
isDecreasingY: isDecreasingY$3,
|
|
786
|
+
transform: transform$3
|
|
787
|
+
};
|
|
770
788
|
//#endregion
|
|
771
789
|
//#region src/curve/cubic2d.ts
|
|
772
790
|
var cubic2d_exports = /* @__PURE__ */ __exportAll({
|
|
773
|
-
Ops: () => Ops,
|
|
774
791
|
asDecreasing: () => asDecreasing$2,
|
|
775
792
|
asIncreasing: () => asIncreasing$2,
|
|
776
793
|
asMonotonic: () => asMonotonic$2,
|
|
@@ -950,29 +967,6 @@ const asIncreasing$2 = asIncreasing$3;
|
|
|
950
967
|
/** @since 2.0.0 */
|
|
951
968
|
const asDecreasing$2 = asDecreasing$3;
|
|
952
969
|
const transform$2 = transform$3;
|
|
953
|
-
/**
|
|
954
|
-
* The {@link Curve2dOps} bundle for `CubicCurve2d`. Used by `CubicPath2d`
|
|
955
|
-
* to wire up the path-level operation surface. The `solveAtX` / `solveAtY`
|
|
956
|
-
* entries narrow the curve's potentially-3-element result to `AtMostOne` —
|
|
957
|
-
* path callers enforce that via the path's `MonotonicX`/`MonotonicY` brand.
|
|
958
|
-
*
|
|
959
|
-
* @since 2.0.0
|
|
960
|
-
*/
|
|
961
|
-
const Ops = {
|
|
962
|
-
solve: solve$2,
|
|
963
|
-
startPoint: startPoint$2,
|
|
964
|
-
endPoint: endPoint$2,
|
|
965
|
-
length,
|
|
966
|
-
boundingBox: boundingBox$2,
|
|
967
|
-
solveAtX: (c, x) => solveAtX$3(c, x),
|
|
968
|
-
solveAtY: (c, y) => solveAtY$3(c, y),
|
|
969
|
-
toPathDataSegment,
|
|
970
|
-
isIncreasingX: isIncreasingX$2,
|
|
971
|
-
isDecreasingX: isDecreasingX$2,
|
|
972
|
-
isIncreasingY: isIncreasingY$2,
|
|
973
|
-
isDecreasingY: isDecreasingY$2,
|
|
974
|
-
transform: transform$2
|
|
975
|
-
};
|
|
976
970
|
//#endregion
|
|
977
971
|
//#region src/curve/rationalCubic2d.internal.ts
|
|
978
972
|
const RationalCubicCurve2dTypeId = Symbol("curvy/curve/rationalCubic2d");
|
|
@@ -1664,6 +1658,6 @@ const asDecreasing = asDecreasing$1;
|
|
|
1664
1658
|
const transform = transform$1;
|
|
1665
1659
|
const approximateAsCubicCurves = approximateAsCubicCurves$1;
|
|
1666
1660
|
//#endregion
|
|
1667
|
-
export {
|
|
1661
|
+
export { fromEndpoints as _, solve as a, fromCoefficients as c, solve$2 as d, Ops as f, Ops$1 as g, solve$4 as h, rationalCubic2d_exports as i, fromPolynomials$2 as l, quadratic2d_exports as m, boundingBox as n, transform as o, derivative as p, fromBezierPoints as r, cubic2d_exports as s, approximateAsCubicCurves as t, length as u, linear2d_exports as v, Ops$2 as y };
|
|
1668
1662
|
|
|
1669
|
-
//# sourceMappingURL=rationalCubic2d-
|
|
1663
|
+
//# sourceMappingURL=rationalCubic2d-gM7VeiiT.mjs.map
|