@ac-kit/math-geometry 0.2.2 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +228 -0
- package/README.md +323 -52
- package/dist/_brand.d.ts +14 -0
- package/dist/_brand.d.ts.map +1 -0
- package/dist/_brand.js +2 -0
- package/dist/_brand.js.map +1 -0
- package/dist/_ear-clipping.d.ts +20 -0
- package/dist/_ear-clipping.d.ts.map +1 -0
- package/dist/_ear-clipping.js +360 -0
- package/dist/_ear-clipping.js.map +1 -0
- package/dist/_ray3-intersect.d.ts +19 -0
- package/dist/_ray3-intersect.d.ts.map +1 -0
- package/dist/_ray3-intersect.js +122 -0
- package/dist/_ray3-intersect.js.map +1 -0
- package/dist/box2-array-boundary.d.ts +50 -0
- package/dist/box2-array-boundary.d.ts.map +1 -0
- package/dist/box2-array-boundary.js +97 -0
- package/dist/box2-array-boundary.js.map +1 -0
- package/dist/box2-array.d.ts +42 -0
- package/dist/box2-array.d.ts.map +1 -0
- package/dist/box2-array.js +134 -0
- package/dist/box2-array.js.map +1 -0
- package/dist/box2-componentwise.d.ts +110 -0
- package/dist/box2-componentwise.d.ts.map +1 -0
- package/dist/box2-componentwise.js +325 -0
- package/dist/box2-componentwise.js.map +1 -0
- package/dist/box2-grid-index.d.ts +67 -0
- package/dist/box2-grid-index.d.ts.map +1 -0
- package/dist/box2-grid-index.js +198 -0
- package/dist/box2-grid-index.js.map +1 -0
- package/dist/box2-record.d.ts +83 -0
- package/dist/box2-record.d.ts.map +1 -0
- package/dist/box2-record.js +124 -0
- package/dist/box2-record.js.map +1 -0
- package/dist/box2.d.ts +38 -0
- package/dist/box2.d.ts.map +1 -0
- package/dist/box2.js +97 -0
- package/dist/box2.js.map +1 -0
- package/dist/box3-array-boundary.d.ts +50 -0
- package/dist/box3-array-boundary.d.ts.map +1 -0
- package/dist/box3-array-boundary.js +107 -0
- package/dist/box3-array-boundary.js.map +1 -0
- package/dist/box3-componentwise.d.ts +110 -0
- package/dist/box3-componentwise.d.ts.map +1 -0
- package/dist/box3-componentwise.js +392 -0
- package/dist/box3-componentwise.js.map +1 -0
- package/dist/box3-record.d.ts +92 -0
- package/dist/box3-record.d.ts.map +1 -0
- package/dist/box3-record.js +147 -0
- package/dist/box3-record.js.map +1 -0
- package/dist/box3.d.ts +19 -16
- package/dist/box3.d.ts.map +1 -1
- package/dist/box3.js +73 -76
- package/dist/box3.js.map +1 -1
- package/dist/box4-array-boundary.d.ts +50 -0
- package/dist/box4-array-boundary.d.ts.map +1 -0
- package/dist/box4-array-boundary.js +117 -0
- package/dist/box4-array-boundary.js.map +1 -0
- package/dist/box4-componentwise.d.ts +110 -0
- package/dist/box4-componentwise.d.ts.map +1 -0
- package/dist/box4-componentwise.js +459 -0
- package/dist/box4-componentwise.js.map +1 -0
- package/dist/box4-record.d.ts +96 -0
- package/dist/box4-record.d.ts.map +1 -0
- package/dist/box4-record.js +167 -0
- package/dist/box4-record.js.map +1 -0
- package/dist/box4.d.ts +13 -8
- package/dist/box4.d.ts.map +1 -1
- package/dist/box4.js +27 -5
- package/dist/box4.js.map +1 -1
- package/dist/circle2-array-boundary.d.ts +51 -0
- package/dist/circle2-array-boundary.d.ts.map +1 -0
- package/dist/circle2-array-boundary.js +93 -0
- package/dist/circle2-array-boundary.js.map +1 -0
- package/dist/circle2-array.d.ts +17 -0
- package/dist/circle2-array.d.ts.map +1 -0
- package/dist/circle2-array.js +44 -0
- package/dist/circle2-array.js.map +1 -0
- package/dist/circle2-record.d.ts +81 -0
- package/dist/circle2-record.d.ts.map +1 -0
- package/dist/circle2-record.js +114 -0
- package/dist/circle2-record.js.map +1 -0
- package/dist/circle2.d.ts +27 -82
- package/dist/circle2.d.ts.map +1 -1
- package/dist/circle2.js +59 -104
- package/dist/circle2.js.map +1 -1
- package/dist/coordinates/cylindrical-record.d.ts +86 -0
- package/dist/coordinates/cylindrical-record.d.ts.map +1 -0
- package/dist/coordinates/cylindrical-record.js +114 -0
- package/dist/coordinates/cylindrical-record.js.map +1 -0
- package/dist/coordinates/horizontal-record.d.ts +86 -0
- package/dist/coordinates/horizontal-record.d.ts.map +1 -0
- package/dist/coordinates/horizontal-record.js +114 -0
- package/dist/coordinates/horizontal-record.js.map +1 -0
- package/dist/coordinates/horizontal.d.ts +48 -0
- package/dist/coordinates/horizontal.d.ts.map +1 -0
- package/dist/coordinates/horizontal.js +100 -0
- package/dist/coordinates/horizontal.js.map +1 -0
- package/dist/coordinates/index.d.ts +10 -0
- package/dist/coordinates/index.d.ts.map +1 -0
- package/dist/coordinates/index.js +10 -0
- package/dist/coordinates/index.js.map +1 -0
- package/dist/coordinates/longitude-latitude-record.d.ts +81 -0
- package/dist/coordinates/longitude-latitude-record.d.ts.map +1 -0
- package/dist/coordinates/longitude-latitude-record.js +104 -0
- package/dist/coordinates/longitude-latitude-record.js.map +1 -0
- package/dist/coordinates/longitude-latitude.d.ts +33 -0
- package/dist/coordinates/longitude-latitude.d.ts.map +1 -0
- package/dist/coordinates/longitude-latitude.js +78 -0
- package/dist/coordinates/longitude-latitude.js.map +1 -0
- package/dist/coordinates/polar-record.d.ts +77 -0
- package/dist/coordinates/polar-record.d.ts.map +1 -0
- package/dist/coordinates/polar-record.js +104 -0
- package/dist/coordinates/polar-record.js.map +1 -0
- package/dist/coordinates/polar.d.ts +28 -0
- package/dist/coordinates/polar.d.ts.map +1 -0
- package/dist/coordinates/polar.js +68 -0
- package/dist/coordinates/polar.js.map +1 -0
- package/dist/coordinates/spherical-cylindrical.d.ts +49 -0
- package/dist/coordinates/spherical-cylindrical.d.ts.map +1 -0
- package/dist/coordinates/spherical-cylindrical.js +110 -0
- package/dist/coordinates/spherical-cylindrical.js.map +1 -0
- package/dist/coordinates/spherical-record.d.ts +86 -0
- package/dist/coordinates/spherical-record.d.ts.map +1 -0
- package/dist/coordinates/spherical-record.js +114 -0
- package/dist/coordinates/spherical-record.js.map +1 -0
- package/dist/frustum3-record.d.ts +132 -0
- package/dist/frustum3-record.d.ts.map +1 -0
- package/dist/frustum3-record.js +333 -0
- package/dist/frustum3-record.js.map +1 -0
- package/dist/frustum3.d.ts +60 -0
- package/dist/frustum3.d.ts.map +1 -0
- package/dist/frustum3.js +186 -0
- package/dist/frustum3.js.map +1 -0
- package/dist/index.d.ts +36 -16
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +36 -16
- package/dist/index.js.map +1 -1
- package/dist/line2-record.d.ts +87 -0
- package/dist/line2-record.d.ts.map +1 -0
- package/dist/line2-record.js +123 -0
- package/dist/line2-record.js.map +1 -0
- package/dist/line2.d.ts +20 -33
- package/dist/line2.d.ts.map +1 -1
- package/dist/line2.js +56 -51
- package/dist/line2.js.map +1 -1
- package/dist/line3-record.d.ts +91 -0
- package/dist/line3-record.d.ts.map +1 -0
- package/dist/line3-record.js +146 -0
- package/dist/line3-record.js.map +1 -0
- package/dist/line3.d.ts +11 -24
- package/dist/line3.d.ts.map +1 -1
- package/dist/line3.js +32 -36
- package/dist/line3.js.map +1 -1
- package/dist/mesh/_generator-kit.d.ts +14 -0
- package/dist/mesh/_generator-kit.d.ts.map +1 -0
- package/dist/mesh/_generator-kit.js +39 -0
- package/dist/mesh/_generator-kit.js.map +1 -0
- package/dist/mesh/_index-kernels-u16.d.ts +43 -0
- package/dist/mesh/_index-kernels-u16.d.ts.map +1 -0
- package/dist/mesh/_index-kernels-u16.js +264 -0
- package/dist/mesh/_index-kernels-u16.js.map +1 -0
- package/dist/mesh/_index-kernels-u32.d.ts +43 -0
- package/dist/mesh/_index-kernels-u32.d.ts.map +1 -0
- package/dist/mesh/_index-kernels-u32.js +264 -0
- package/dist/mesh/_index-kernels-u32.js.map +1 -0
- package/dist/mesh/generate-box.d.ts +16 -0
- package/dist/mesh/generate-box.d.ts.map +1 -0
- package/dist/mesh/generate-box.js +79 -0
- package/dist/mesh/generate-box.js.map +1 -0
- package/dist/mesh/generate-cylinder.d.ts +25 -0
- package/dist/mesh/generate-cylinder.d.ts.map +1 -0
- package/dist/mesh/generate-cylinder.js +117 -0
- package/dist/mesh/generate-cylinder.js.map +1 -0
- package/dist/mesh/generate-heightfield.d.ts +24 -0
- package/dist/mesh/generate-heightfield.d.ts.map +1 -0
- package/dist/mesh/generate-heightfield.js +48 -0
- package/dist/mesh/generate-heightfield.js.map +1 -0
- package/dist/mesh/generate-plane.d.ts +18 -0
- package/dist/mesh/generate-plane.d.ts.map +1 -0
- package/dist/mesh/generate-plane.js +39 -0
- package/dist/mesh/generate-plane.js.map +1 -0
- package/dist/mesh/generate-sphere.d.ts +50 -0
- package/dist/mesh/generate-sphere.d.ts.map +1 -0
- package/dist/mesh/generate-sphere.js +244 -0
- package/dist/mesh/generate-sphere.js.map +1 -0
- package/dist/mesh/index.d.ts +8 -0
- package/dist/mesh/index.d.ts.map +1 -0
- package/dist/mesh/index.js +8 -0
- package/dist/mesh/index.js.map +1 -0
- package/dist/mesh/mesh3-kernels.d.ts +82 -0
- package/dist/mesh/mesh3-kernels.d.ts.map +1 -0
- package/dist/mesh/mesh3-kernels.js +180 -0
- package/dist/mesh/mesh3-kernels.js.map +1 -0
- package/dist/mesh/mesh3.d.ts +66 -0
- package/dist/mesh/mesh3.d.ts.map +1 -0
- package/dist/mesh/mesh3.js +128 -0
- package/dist/mesh/mesh3.js.map +1 -0
- package/dist/plane3-record.d.ts +88 -0
- package/dist/plane3-record.d.ts.map +1 -0
- package/dist/plane3-record.js +123 -0
- package/dist/plane3-record.js.map +1 -0
- package/dist/plane3.d.ts +42 -28
- package/dist/plane3.d.ts.map +1 -1
- package/dist/plane3.js +166 -48
- package/dist/plane3.js.map +1 -1
- package/dist/polygon2.d.ts +82 -29
- package/dist/polygon2.d.ts.map +1 -1
- package/dist/polygon2.js +236 -93
- package/dist/polygon2.js.map +1 -1
- package/dist/polygon3.d.ts +40 -21
- package/dist/polygon3.d.ts.map +1 -1
- package/dist/polygon3.js +215 -91
- package/dist/polygon3.js.map +1 -1
- package/dist/polyline2.d.ts +37 -0
- package/dist/polyline2.d.ts.map +1 -0
- package/dist/polyline2.js +146 -0
- package/dist/polyline2.js.map +1 -0
- package/dist/polyline3.d.ts +35 -0
- package/dist/polyline3.d.ts.map +1 -0
- package/dist/polyline3.js +159 -0
- package/dist/polyline3.js.map +1 -0
- package/dist/quadtree.d.ts +238 -0
- package/dist/quadtree.d.ts.map +1 -0
- package/dist/quadtree.js +1019 -0
- package/dist/quadtree.js.map +1 -0
- package/dist/ray2-record.d.ts +86 -0
- package/dist/ray2-record.d.ts.map +1 -0
- package/dist/ray2-record.js +123 -0
- package/dist/ray2-record.js.map +1 -0
- package/dist/ray2.d.ts +38 -13
- package/dist/ray2.d.ts.map +1 -1
- package/dist/ray2.js +85 -22
- package/dist/ray2.js.map +1 -1
- package/dist/ray3-array.d.ts +27 -0
- package/dist/ray3-array.d.ts.map +1 -0
- package/dist/ray3-array.js +89 -0
- package/dist/ray3-array.js.map +1 -0
- package/dist/ray3-record.d.ts +90 -0
- package/dist/ray3-record.d.ts.map +1 -0
- package/dist/ray3-record.js +146 -0
- package/dist/ray3-record.js.map +1 -0
- package/dist/ray3.d.ts +72 -25
- package/dist/ray3.d.ts.map +1 -1
- package/dist/ray3.js +233 -64
- package/dist/ray3.js.map +1 -1
- package/dist/segment2-record.d.ts +80 -0
- package/dist/segment2-record.d.ts.map +1 -0
- package/dist/segment2-record.js +122 -0
- package/dist/segment2-record.js.map +1 -0
- package/dist/segment2.d.ts +34 -19
- package/dist/segment2.d.ts.map +1 -1
- package/dist/segment2.js +88 -42
- package/dist/segment2.js.map +1 -1
- package/dist/segment3-record.d.ts +90 -0
- package/dist/segment3-record.d.ts.map +1 -0
- package/dist/segment3-record.js +146 -0
- package/dist/segment3-record.js.map +1 -0
- package/dist/segment3.d.ts +24 -12
- package/dist/segment3.d.ts.map +1 -1
- package/dist/segment3.js +67 -30
- package/dist/segment3.js.map +1 -1
- package/dist/size.d.ts +40 -0
- package/dist/size.d.ts.map +1 -0
- package/dist/size.js +72 -0
- package/dist/size.js.map +1 -0
- package/dist/sphere3-array-boundary.d.ts +51 -0
- package/dist/sphere3-array-boundary.d.ts.map +1 -0
- package/dist/sphere3-array-boundary.js +98 -0
- package/dist/sphere3-array-boundary.js.map +1 -0
- package/dist/sphere3-record.d.ts +88 -0
- package/dist/sphere3-record.d.ts.map +1 -0
- package/dist/sphere3-record.js +123 -0
- package/dist/sphere3-record.js.map +1 -0
- package/dist/sphere3.d.ts +55 -12
- package/dist/sphere3.d.ts.map +1 -1
- package/dist/sphere3.js +233 -24
- package/dist/sphere3.js.map +1 -1
- package/dist/spherical/cap.d.ts +56 -0
- package/dist/spherical/cap.d.ts.map +1 -0
- package/dist/spherical/cap.js +363 -0
- package/dist/spherical/cap.js.map +1 -0
- package/dist/spherical/great-circle.d.ts +39 -0
- package/dist/spherical/great-circle.d.ts.map +1 -0
- package/dist/spherical/great-circle.js +158 -0
- package/dist/spherical/great-circle.js.map +1 -0
- package/dist/spherical/index.d.ts +3 -0
- package/dist/spherical/index.d.ts.map +1 -0
- package/dist/spherical/index.js +3 -0
- package/dist/spherical/index.js.map +1 -0
- package/dist/triangle2-record.d.ts +91 -0
- package/dist/triangle2-record.d.ts.map +1 -0
- package/dist/triangle2-record.js +146 -0
- package/dist/triangle2-record.js.map +1 -0
- package/dist/triangle2.d.ts +29 -14
- package/dist/triangle2.d.ts.map +1 -1
- package/dist/triangle2.js +86 -22
- package/dist/triangle2.js.map +1 -1
- package/dist/triangle3-record.d.ts +97 -0
- package/dist/triangle3-record.d.ts.map +1 -0
- package/dist/triangle3-record.js +178 -0
- package/dist/triangle3-record.js.map +1 -0
- package/dist/triangle3.d.ts +41 -17
- package/dist/triangle3.d.ts.map +1 -1
- package/dist/triangle3.js +267 -38
- package/dist/triangle3.js.map +1 -1
- package/package.json +15 -8
- package/dist/angles.d.ts +0 -31
- package/dist/angles.d.ts.map +0 -1
- package/dist/angles.js +0 -53
- package/dist/angles.js.map +0 -1
- package/dist/coordinate-spaces.d.ts +0 -39
- package/dist/coordinate-spaces.d.ts.map +0 -1
- package/dist/coordinate-spaces.js +0 -52
- package/dist/coordinate-spaces.js.map +0 -1
- package/dist/coordinates-vec2.d.ts +0 -7
- package/dist/coordinates-vec2.d.ts.map +0 -1
- package/dist/coordinates-vec2.js +0 -35
- package/dist/coordinates-vec2.js.map +0 -1
- package/dist/coordinates-vec3.d.ts +0 -11
- package/dist/coordinates-vec3.d.ts.map +0 -1
- package/dist/coordinates-vec3.js +0 -61
- package/dist/coordinates-vec3.js.map +0 -1
- package/dist/coordinates.d.ts +0 -54
- package/dist/coordinates.d.ts.map +0 -1
- package/dist/coordinates.js +0 -2
- package/dist/coordinates.js.map +0 -1
- package/dist/euler-angles-quaternion.d.ts +0 -7
- package/dist/euler-angles-quaternion.d.ts.map +0 -1
- package/dist/euler-angles-quaternion.js +0 -100
- package/dist/euler-angles-quaternion.js.map +0 -1
- package/dist/euler-angles.d.ts +0 -33
- package/dist/euler-angles.d.ts.map +0 -1
- package/dist/euler-angles.js +0 -35
- package/dist/euler-angles.js.map +0 -1
- package/dist/geometry-vectors.d.ts +0 -11
- package/dist/geometry-vectors.d.ts.map +0 -1
- package/dist/geometry-vectors.js +0 -19
- package/dist/geometry-vectors.js.map +0 -1
- package/dist/mesh3.d.ts +0 -32
- package/dist/mesh3.d.ts.map +0 -1
- package/dist/mesh3.js +0 -142
- package/dist/mesh3.js.map +0 -1
- package/dist/point2.d.ts +0 -41
- package/dist/point2.d.ts.map +0 -1
- package/dist/point2.js +0 -92
- package/dist/point2.js.map +0 -1
- package/dist/point3.d.ts +0 -43
- package/dist/point3.d.ts.map +0 -1
- package/dist/point3.js +0 -103
- package/dist/point3.js.map +0 -1
- package/dist/point4.d.ts +0 -12
- package/dist/point4.d.ts.map +0 -1
- package/dist/point4.js +0 -28
- package/dist/point4.js.map +0 -1
- package/dist/rect2.d.ts +0 -54
- package/dist/rect2.d.ts.map +0 -1
- package/dist/rect2.js +0 -149
- package/dist/rect2.js.map +0 -1
- package/dist/size2.d.ts +0 -33
- package/dist/size2.d.ts.map +0 -1
- package/dist/size2.js +0 -81
- package/dist/size2.js.map +0 -1
- package/dist/size3.d.ts +0 -21
- package/dist/size3.d.ts.map +0 -1
- package/dist/size3.js +0 -59
- package/dist/size3.js.map +0 -1
- package/dist/size4.d.ts +0 -10
- package/dist/size4.d.ts.map +0 -1
- package/dist/size4.js +0 -16
- package/dist/size4.js.map +0 -1
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import type { Brand_ } from "./_brand.js";
|
|
2
|
+
/**
|
|
3
|
+
* A ray in space: an origin then a direction, which need not be a unit vector;
|
|
4
|
+
* a parameter `t ≥ 0` is in units of the direction's length.
|
|
5
|
+
*
|
|
6
|
+
* A plain array of 6 binary64 numbers carrying a type-level brand, holding
|
|
7
|
+
* exactly the numbers one element of the matching bulk buffer holds, in the
|
|
8
|
+
* same order.
|
|
9
|
+
*
|
|
10
|
+
* Only {@link ray3Create}, {@link ray3Of}, {@link ray3Clone}, {@link ray3FromArray}
|
|
11
|
+
* and the functions that write an `out` make one; see `Vec3` in
|
|
12
|
+
* `@ac-kit/math-linear` for the rules that bind callers who bypass the types.
|
|
13
|
+
*/
|
|
14
|
+
export type Ray3 = [
|
|
15
|
+
originX: number,
|
|
16
|
+
originY: number,
|
|
17
|
+
originZ: number,
|
|
18
|
+
directionX: number,
|
|
19
|
+
directionY: number,
|
|
20
|
+
directionZ: number
|
|
21
|
+
] & Brand_<"Ray3">;
|
|
22
|
+
/** A {@link Ray3} that is only read. */
|
|
23
|
+
export type ReadonlyRay3 = readonly [
|
|
24
|
+
originX: number,
|
|
25
|
+
originY: number,
|
|
26
|
+
originZ: number,
|
|
27
|
+
directionX: number,
|
|
28
|
+
directionY: number,
|
|
29
|
+
directionZ: number
|
|
30
|
+
] & Brand_<"Ray3">;
|
|
31
|
+
/**
|
|
32
|
+
* Creates the ray at the origin with a zero direction.
|
|
33
|
+
*
|
|
34
|
+
* Allocates; keep it out of hot loops.
|
|
35
|
+
*/
|
|
36
|
+
export declare function ray3Create(): Ray3;
|
|
37
|
+
/**
|
|
38
|
+
* Creates the ray with the components `originX, originY, originZ, directionX,
|
|
39
|
+
* directionY, directionZ`, in storage order.
|
|
40
|
+
*
|
|
41
|
+
* Allocates; keep it out of hot loops.
|
|
42
|
+
*/
|
|
43
|
+
export declare function ray3Of(originX: number, originY: number, originZ: number, directionX: number, directionY: number, directionZ: number): Ray3;
|
|
44
|
+
/**
|
|
45
|
+
* Creates a copy of `a`. Like every creator it starts from a clean array.
|
|
46
|
+
*
|
|
47
|
+
* Allocates; keep it out of hot loops.
|
|
48
|
+
*/
|
|
49
|
+
export declare function ray3Clone(a: ReadonlyRay3): Ray3;
|
|
50
|
+
/** Writes the components, in storage order, into `out`. */
|
|
51
|
+
export declare function ray3Set(out: Ray3, originX: number, originY: number, originZ: number, directionX: number, directionY: number, directionZ: number): Ray3;
|
|
52
|
+
/** Writes a copy of `a` into `out`. `out` may be `a`. */
|
|
53
|
+
export declare function ray3Copy(out: Ray3, a: ReadonlyRay3): Ray3;
|
|
54
|
+
/**
|
|
55
|
+
* Exact component-wise equality: `−0` equals `+0`, `NaN` equals nothing, itself
|
|
56
|
+
* included, and an infinity equals itself. See {@link ray3IsClose} for a
|
|
57
|
+
* tolerant test.
|
|
58
|
+
*/
|
|
59
|
+
export declare function ray3Equals(a: ReadonlyRay3, b: ReadonlyRay3): boolean;
|
|
60
|
+
/**
|
|
61
|
+
* Component-wise approximate equality: every pair differs by at most
|
|
62
|
+
* `tolerance`, an absolute bound in the caller's units, and an infinity is
|
|
63
|
+
* close only to itself. Not transitive, so never a basis for ordering or a
|
|
64
|
+
* container key: use {@link ray3Equals} there.
|
|
65
|
+
*
|
|
66
|
+
* @param tolerance Defaults to `geometryConfig.defaultLinearTolerance`.
|
|
67
|
+
*/
|
|
68
|
+
export declare function ray3IsClose(a: ReadonlyRay3, b: ReadonlyRay3, tolerance?: number): boolean;
|
|
69
|
+
/**
|
|
70
|
+
* The checked way in from untyped data (JSON, messages, arrays of unknown
|
|
71
|
+
* origin): `source[offset … offset + 6)` copied into `out`, each element that
|
|
72
|
+
* is not a number written as `NaN`, an index past the end of `source` too, so
|
|
73
|
+
* `out` never holds a non-number. A cold path: buffers use {@link ray3Load}.
|
|
74
|
+
* O(1).
|
|
75
|
+
*
|
|
76
|
+
* `source` may be `out` itself: the 6 elements are read before the first write.
|
|
77
|
+
*
|
|
78
|
+
* @param out The ray to fill.
|
|
79
|
+
* @param source The array to read, of any length and any content.
|
|
80
|
+
* @param offset The index of the first component in `source`.
|
|
81
|
+
* @returns `out`.
|
|
82
|
+
*/
|
|
83
|
+
export declare function ray3FromArray(out: Ray3, source: ArrayLike<number>, offset?: number): Ray3;
|
|
84
|
+
/**
|
|
85
|
+
* Whether every component is a finite number: the check to run after parsing
|
|
86
|
+
* untrusted data or before an upload, as operations never check. A component
|
|
87
|
+
* that is not a number at all counts as not finite.
|
|
88
|
+
*/
|
|
89
|
+
export declare function ray3IsFinite(value: ReadonlyRay3): boolean;
|
|
90
|
+
//# sourceMappingURL=ray3-record.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ray3-record.d.ts","sourceRoot":"","sources":["../src/ray3-record.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAG1C;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,IAAI,GAAG;IAClB,OAAO,EAAE,MAAM;IACf,OAAO,EAAE,MAAM;IACf,OAAO,EAAE,MAAM;IACf,UAAU,EAAE,MAAM;IAClB,UAAU,EAAE,MAAM;IAClB,UAAU,EAAE,MAAM;CAClB,GACA,MAAM,CAAC,MAAM,CAAC,CAAC;AAEhB,wCAAwC;AACxC,MAAM,MAAM,YAAY,GAAG,SAAS;IACnC,OAAO,EAAE,MAAM;IACf,OAAO,EAAE,MAAM;IACf,OAAO,EAAE,MAAM;IACf,UAAU,EAAE,MAAM;IAClB,UAAU,EAAE,MAAM;IAClB,UAAU,EAAE,MAAM;CAClB,GACA,MAAM,CAAC,MAAM,CAAC,CAAC;AAQhB;;;;GAIG;AACH,wBAAgB,UAAU,IAAI,IAAI,CASjC;AAED;;;;;GAKG;AACH,wBAAgB,MAAM,CACrB,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,MAAM,GAChB,IAAI,CASN;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,YAAY,GAAG,IAAI,CAS/C;AAED,2DAA2D;AAC3D,wBAAgB,OAAO,CACtB,GAAG,EAAE,IAAI,EACT,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,MAAM,GAChB,IAAI,CAQN;AAED,yDAAyD;AACzD,wBAAgB,QAAQ,CAAC,GAAG,EAAE,IAAI,EAAE,CAAC,EAAE,YAAY,GAAG,IAAI,CAQzD;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAAE,YAAY,EAAE,CAAC,EAAE,YAAY,GAAG,OAAO,CASpE;AAED;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAC1B,CAAC,EAAE,YAAY,EACf,CAAC,EAAE,YAAY,EACf,SAAS,GAAE,MAA8C,GACvD,OAAO,CAST;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,aAAa,CAC5B,GAAG,EAAE,IAAI,EACT,MAAM,EAAE,SAAS,CAAC,MAAM,CAAC,EACzB,MAAM,SAAI,GACR,IAAI,CAcN;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO,CASzD"}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
// Generated from scripts/templates/record.liquid by scripts/generate-records.ts. Do not edit.
|
|
2
|
+
import { isCloseAbsolute, numberAtOrNaN } from "@ac-kit/core";
|
|
3
|
+
import { geometryConfig } from "./globals.js";
|
|
4
|
+
/**
|
|
5
|
+
* Every creator copies this array, which holds non-integer doubles and is never
|
|
6
|
+
* exposed: nothing a caller does can change the element kind it copies.
|
|
7
|
+
*/
|
|
8
|
+
const TEMPLATE_ = [0.5, 0.5, 0.5, 0.5, 0.5, 0.5];
|
|
9
|
+
/**
|
|
10
|
+
* Creates the ray at the origin with a zero direction.
|
|
11
|
+
*
|
|
12
|
+
* Allocates; keep it out of hot loops.
|
|
13
|
+
*/
|
|
14
|
+
export function ray3Create() {
|
|
15
|
+
const out = TEMPLATE_.slice();
|
|
16
|
+
out[0] = 0;
|
|
17
|
+
out[1] = 0;
|
|
18
|
+
out[2] = 0;
|
|
19
|
+
out[3] = 0;
|
|
20
|
+
out[4] = 0;
|
|
21
|
+
out[5] = 0;
|
|
22
|
+
return out;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Creates the ray with the components `originX, originY, originZ, directionX,
|
|
26
|
+
* directionY, directionZ`, in storage order.
|
|
27
|
+
*
|
|
28
|
+
* Allocates; keep it out of hot loops.
|
|
29
|
+
*/
|
|
30
|
+
export function ray3Of(originX, originY, originZ, directionX, directionY, directionZ) {
|
|
31
|
+
const out = TEMPLATE_.slice();
|
|
32
|
+
out[0] = originX;
|
|
33
|
+
out[1] = originY;
|
|
34
|
+
out[2] = originZ;
|
|
35
|
+
out[3] = directionX;
|
|
36
|
+
out[4] = directionY;
|
|
37
|
+
out[5] = directionZ;
|
|
38
|
+
return out;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Creates a copy of `a`. Like every creator it starts from a clean array.
|
|
42
|
+
*
|
|
43
|
+
* Allocates; keep it out of hot loops.
|
|
44
|
+
*/
|
|
45
|
+
export function ray3Clone(a) {
|
|
46
|
+
const out = TEMPLATE_.slice();
|
|
47
|
+
out[0] = a[0];
|
|
48
|
+
out[1] = a[1];
|
|
49
|
+
out[2] = a[2];
|
|
50
|
+
out[3] = a[3];
|
|
51
|
+
out[4] = a[4];
|
|
52
|
+
out[5] = a[5];
|
|
53
|
+
return out;
|
|
54
|
+
}
|
|
55
|
+
/** Writes the components, in storage order, into `out`. */
|
|
56
|
+
export function ray3Set(out, originX, originY, originZ, directionX, directionY, directionZ) {
|
|
57
|
+
out[0] = originX;
|
|
58
|
+
out[1] = originY;
|
|
59
|
+
out[2] = originZ;
|
|
60
|
+
out[3] = directionX;
|
|
61
|
+
out[4] = directionY;
|
|
62
|
+
out[5] = directionZ;
|
|
63
|
+
return out;
|
|
64
|
+
}
|
|
65
|
+
/** Writes a copy of `a` into `out`. `out` may be `a`. */
|
|
66
|
+
export function ray3Copy(out, a) {
|
|
67
|
+
out[0] = a[0];
|
|
68
|
+
out[1] = a[1];
|
|
69
|
+
out[2] = a[2];
|
|
70
|
+
out[3] = a[3];
|
|
71
|
+
out[4] = a[4];
|
|
72
|
+
out[5] = a[5];
|
|
73
|
+
return out;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Exact component-wise equality: `−0` equals `+0`, `NaN` equals nothing, itself
|
|
77
|
+
* included, and an infinity equals itself. See {@link ray3IsClose} for a
|
|
78
|
+
* tolerant test.
|
|
79
|
+
*/
|
|
80
|
+
export function ray3Equals(a, b) {
|
|
81
|
+
return (a[0] === b[0] &&
|
|
82
|
+
a[1] === b[1] &&
|
|
83
|
+
a[2] === b[2] &&
|
|
84
|
+
a[3] === b[3] &&
|
|
85
|
+
a[4] === b[4] &&
|
|
86
|
+
a[5] === b[5]);
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Component-wise approximate equality: every pair differs by at most
|
|
90
|
+
* `tolerance`, an absolute bound in the caller's units, and an infinity is
|
|
91
|
+
* close only to itself. Not transitive, so never a basis for ordering or a
|
|
92
|
+
* container key: use {@link ray3Equals} there.
|
|
93
|
+
*
|
|
94
|
+
* @param tolerance Defaults to `geometryConfig.defaultLinearTolerance`.
|
|
95
|
+
*/
|
|
96
|
+
export function ray3IsClose(a, b, tolerance = geometryConfig.defaultLinearTolerance) {
|
|
97
|
+
return (isCloseAbsolute(a[0], b[0], tolerance) &&
|
|
98
|
+
isCloseAbsolute(a[1], b[1], tolerance) &&
|
|
99
|
+
isCloseAbsolute(a[2], b[2], tolerance) &&
|
|
100
|
+
isCloseAbsolute(a[3], b[3], tolerance) &&
|
|
101
|
+
isCloseAbsolute(a[4], b[4], tolerance) &&
|
|
102
|
+
isCloseAbsolute(a[5], b[5], tolerance));
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* The checked way in from untyped data (JSON, messages, arrays of unknown
|
|
106
|
+
* origin): `source[offset … offset + 6)` copied into `out`, each element that
|
|
107
|
+
* is not a number written as `NaN`, an index past the end of `source` too, so
|
|
108
|
+
* `out` never holds a non-number. A cold path: buffers use {@link ray3Load}.
|
|
109
|
+
* O(1).
|
|
110
|
+
*
|
|
111
|
+
* `source` may be `out` itself: the 6 elements are read before the first write.
|
|
112
|
+
*
|
|
113
|
+
* @param out The ray to fill.
|
|
114
|
+
* @param source The array to read, of any length and any content.
|
|
115
|
+
* @param offset The index of the first component in `source`.
|
|
116
|
+
* @returns `out`.
|
|
117
|
+
*/
|
|
118
|
+
export function ray3FromArray(out, source, offset = 0) {
|
|
119
|
+
const value0 = numberAtOrNaN(source, offset);
|
|
120
|
+
const value1 = numberAtOrNaN(source, offset + 1);
|
|
121
|
+
const value2 = numberAtOrNaN(source, offset + 2);
|
|
122
|
+
const value3 = numberAtOrNaN(source, offset + 3);
|
|
123
|
+
const value4 = numberAtOrNaN(source, offset + 4);
|
|
124
|
+
const value5 = numberAtOrNaN(source, offset + 5);
|
|
125
|
+
out[0] = value0;
|
|
126
|
+
out[1] = value1;
|
|
127
|
+
out[2] = value2;
|
|
128
|
+
out[3] = value3;
|
|
129
|
+
out[4] = value4;
|
|
130
|
+
out[5] = value5;
|
|
131
|
+
return out;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Whether every component is a finite number: the check to run after parsing
|
|
135
|
+
* untrusted data or before an upload, as operations never check. A component
|
|
136
|
+
* that is not a number at all counts as not finite.
|
|
137
|
+
*/
|
|
138
|
+
export function ray3IsFinite(value) {
|
|
139
|
+
return (Number.isFinite(value[0]) &&
|
|
140
|
+
Number.isFinite(value[1]) &&
|
|
141
|
+
Number.isFinite(value[2]) &&
|
|
142
|
+
Number.isFinite(value[3]) &&
|
|
143
|
+
Number.isFinite(value[4]) &&
|
|
144
|
+
Number.isFinite(value[5]));
|
|
145
|
+
}
|
|
146
|
+
//# sourceMappingURL=ray3-record.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ray3-record.js","sourceRoot":"","sources":["../src/ray3-record.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAE9F,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAG9D,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAmC9C;;;GAGG;AACH,MAAM,SAAS,GAAsB,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;AAEpE;;;;GAIG;AACH,MAAM,UAAU,UAAU;IACzB,MAAM,GAAG,GAAG,SAAS,CAAC,KAAK,EAAU,CAAC;IACtC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;IACX,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;IACX,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;IACX,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;IACX,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;IACX,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;IACX,OAAO,GAAG,CAAC;AACZ,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,MAAM,CACrB,OAAe,EACf,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,CAAC,CAAC,GAAG,MAAM,CAAC;IAChB,GAAG,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC;IAChB,GAAG,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC;IAChB,GAAG,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC;IAChB,OAAO,GAAG,CAAC;AACZ,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,YAAY,CAAC,KAAmB;IAC/C,OAAO,CACN,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QACzB,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QACzB,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QACzB,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QACzB,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QACzB,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CACzB,CAAC;AACH,CAAC"}
|
package/dist/ray3.d.ts
CHANGED
|
@@ -1,30 +1,77 @@
|
|
|
1
|
-
import { Vec3 } from "@ac-kit/math-linear";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
export declare function
|
|
14
|
-
/**
|
|
15
|
-
export declare function
|
|
16
|
-
/**
|
|
17
|
-
|
|
18
|
-
|
|
1
|
+
import type { DepthRange, ReadonlyAffine3, ReadonlyMat4x4, ReadonlyVec3, ReadonlyViewport, Vec2, Vec3 } from "@ac-kit/math-linear";
|
|
2
|
+
import type { ReadonlyBox3 } from "./box3-record.js";
|
|
3
|
+
import type { ReadonlyPlane3 } from "./plane3-record.js";
|
|
4
|
+
import type { Ray3, ReadonlyRay3 } from "./ray3-record.js";
|
|
5
|
+
import type { ReadonlySphere3 } from "./sphere3-record.js";
|
|
6
|
+
import type { ReadonlyTriangle3 } from "./triangle3-record.js";
|
|
7
|
+
/** Writes the point `origin + t · direction` into `out`. */
|
|
8
|
+
export declare function ray3At(out: Vec3, ray: ReadonlyRay3, t: number): Vec3;
|
|
9
|
+
/**
|
|
10
|
+
* The parameter `t ≥ 0`, in units of the direction's length, of the point of
|
|
11
|
+
* the ray nearest to `point`; a zero direction gives `0`.
|
|
12
|
+
*/
|
|
13
|
+
export declare function ray3ClosestParameter(ray: ReadonlyRay3, point: ReadonlyVec3): number;
|
|
14
|
+
/** Writes the point of the ray nearest to `point` into `out`. */
|
|
15
|
+
export declare function ray3ClosestPoint(out: Vec3, ray: ReadonlyRay3, point: ReadonlyVec3): Vec3;
|
|
16
|
+
/** The distance from `point` to the ray. */
|
|
17
|
+
export declare function ray3DistanceToPoint(ray: ReadonlyRay3, point: ReadonlyVec3): number;
|
|
18
|
+
/**
|
|
19
|
+
* Writes the ray that starts at `ray`'s point at parameter `t` and keeps its
|
|
20
|
+
* direction into `out`. `out` may be `ray`.
|
|
21
|
+
*/
|
|
22
|
+
export declare function ray3Recast(out: Ray3, ray: ReadonlyRay3, t: number): Ray3;
|
|
23
|
+
/**
|
|
24
|
+
* The parameter `t ≥ 0` at which the ray crosses the plane, `Infinity` for a
|
|
25
|
+
* miss: parallel (`|n · d| ≤ tolerance · |n| · |d|`, a ray lying in the plane
|
|
26
|
+
* included) or pointing away from it. The point is {@link ray3At}.
|
|
19
27
|
*
|
|
20
|
-
* @param tolerance
|
|
21
|
-
*
|
|
22
|
-
|
|
28
|
+
* @param tolerance Dimensionless bound on the sine of the angle between the ray
|
|
29
|
+
* and the plane; defaults to `geometryConfig.defaultAngularTolerance`.
|
|
30
|
+
*/
|
|
31
|
+
export declare function ray3IntersectPlane3(ray: ReadonlyRay3, plane: ReadonlyPlane3, tolerance?: number): number;
|
|
32
|
+
/**
|
|
33
|
+
* The parameter `t ≥ 0` of the nearest hit of the ray with the ball, `Infinity`
|
|
34
|
+
* for a miss or a negative radius; an origin inside gives the far side. A zero
|
|
35
|
+
* direction gives `NaN`.
|
|
23
36
|
*/
|
|
24
|
-
export declare function
|
|
37
|
+
export declare function ray3IntersectSphere3(ray: ReadonlyRay3, sphere: ReadonlySphere3): number;
|
|
25
38
|
/**
|
|
26
|
-
*
|
|
27
|
-
* origin
|
|
39
|
+
* The parameter `t ≥ 0` of the nearest hit of the ray with the box (slab test):
|
|
40
|
+
* `0` for an origin inside, `Infinity` for a miss or an empty box.
|
|
41
|
+
*/
|
|
42
|
+
export declare function ray3IntersectBox3(ray: ReadonlyRay3, box: ReadonlyBox3): number;
|
|
43
|
+
/**
|
|
44
|
+
* Möller–Trumbore: the parameter `t ≥ 0` at which the ray crosses the triangle,
|
|
45
|
+
* `Infinity` for a miss. On a hit `out` holds the barycentric coordinates `[u,
|
|
46
|
+
* v]` of the point (`a·(1 − u − v) + b·u + c·v`); on a miss `NaN`. A triangle
|
|
47
|
+
* seen from behind (its counter-clockwise normal pointing away from the ray) is
|
|
48
|
+
* a miss when `cullBackFaces` is set. A ray parallel to the triangle is a
|
|
49
|
+
* miss.
|
|
50
|
+
*/
|
|
51
|
+
export declare function ray3IntersectTriangle3(out: Vec2, ray: ReadonlyRay3, triangle: ReadonlyTriangle3, cullBackFaces: boolean): number;
|
|
52
|
+
/**
|
|
53
|
+
* Writes the ray moved by `transform` into `out`: the origin as a point, the
|
|
54
|
+
* direction as a vector (the translation does not apply, and the length scales
|
|
55
|
+
* with the transform, so a `t` along the result is a `t` along the input).
|
|
56
|
+
* `out` may be `ray`.
|
|
57
|
+
*/
|
|
58
|
+
export declare function ray3TransformAffine3(out: Ray3, ray: ReadonlyRay3, transform: ReadonlyAffine3): Ray3;
|
|
59
|
+
/**
|
|
60
|
+
* Writes the picking ray through the pixel `(x, y)` into `out`: the origin is
|
|
61
|
+
* the point unprojected at the near plane's depth of `depthRange` (`0` for
|
|
62
|
+
* `"zero-to-one"`, `−1` for `"negative-one-to-one"`, `1` for `"one-to-zero"`),
|
|
63
|
+
* the direction points toward the far plane's depth and is a unit vector. Both
|
|
64
|
+
* unproject in homogeneous coordinates, so an infinite far plane (`w = 0`
|
|
65
|
+
* there) still gives a finite direction in all three ranges.
|
|
66
|
+
*
|
|
67
|
+
* `depthRange` must be the projection's own: with a reversed infinite
|
|
68
|
+
* projection, `"zero-to-one"` would unproject the origin at infinity. A
|
|
69
|
+
* non-finite origin or direction (a singular matrix, an eye-plane origin, a
|
|
70
|
+
* zero-size viewport) writes `NaN` into every component of `out`: nothing
|
|
71
|
+
* throws.
|
|
72
|
+
*
|
|
73
|
+
* @param inverseViewProjection `mat4x4Invert` of the view-projection.
|
|
74
|
+
* @param viewport The render target in pixels, origin top-left, y down.
|
|
28
75
|
*/
|
|
29
|
-
export declare function
|
|
76
|
+
export declare function ray3FromViewport(out: Ray3, x: number, y: number, inverseViewProjection: ReadonlyMat4x4, viewport: ReadonlyViewport, depthRange: DepthRange): Ray3;
|
|
30
77
|
//# sourceMappingURL=ray3.d.ts.map
|
package/dist/ray3.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ray3.d.ts","sourceRoot":"","sources":["../src/ray3.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"ray3.d.ts","sourceRoot":"","sources":["../src/ray3.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,UAAU,EACV,eAAe,EACf,cAAc,EACd,YAAY,EACZ,gBAAgB,EAChB,IAAI,EACJ,IAAI,EACJ,MAAM,qBAAqB,CAAC;AAG7B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAErD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,KAAK,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,KAAK,EAAE,eAAe,EA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