@ac-kit/math-geometry 0.2.3 → 0.4.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 +321 -0
- package/README.md +363 -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/_polygon3-cross.d.ts +23 -0
- package/dist/_polygon3-cross.d.ts.map +1 -0
- package/dist/_polygon3-cross.js +418 -0
- package/dist/_polygon3-cross.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/_triangle3-cross.d.ts +66 -0
- package/dist/_triangle3-cross.d.ts.map +1 -0
- package/dist/_triangle3-cross.js +396 -0
- package/dist/_triangle3-cross.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 +24 -33
- package/dist/line2.d.ts.map +1 -1
- package/dist/line2.js +78 -52
- 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 +85 -0
- package/dist/mesh/_index-kernels-u16.d.ts.map +1 -0
- package/dist/mesh/_index-kernels-u16.js +1045 -0
- package/dist/mesh/_index-kernels-u16.js.map +1 -0
- package/dist/mesh/_index-kernels-u32.d.ts +85 -0
- package/dist/mesh/_index-kernels-u32.d.ts.map +1 -0
- package/dist/mesh/_index-kernels-u32.js +1045 -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 +122 -0
- package/dist/mesh/mesh3-kernels.d.ts.map +1 -0
- package/dist/mesh/mesh3-kernels.js +220 -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 +43 -28
- package/dist/plane3.d.ts.map +1 -1
- package/dist/plane3.js +149 -48
- package/dist/plane3.js.map +1 -1
- package/dist/polygon2.d.ts +132 -29
- package/dist/polygon2.d.ts.map +1 -1
- package/dist/polygon2.js +529 -96
- package/dist/polygon2.js.map +1 -1
- package/dist/polygon3.d.ts +56 -21
- package/dist/polygon3.d.ts.map +1 -1
- package/dist/polygon3.js +239 -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 +255 -0
- package/dist/quadtree.d.ts.map +1 -0
- package/dist/quadtree.js +1096 -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 +39 -19
- package/dist/segment2.d.ts.map +1 -1
- package/dist/segment2.js +104 -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 +60 -17
- package/dist/triangle3.d.ts.map +1 -1
- package/dist/triangle3.js +287 -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,167 @@
|
|
|
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, 0.5, 0.5];
|
|
9
|
+
/**
|
|
10
|
+
* Creates the empty box (`+∞` minima, `−∞` maxima): nothing intersects it, and
|
|
11
|
+
* its union with a box is that box.
|
|
12
|
+
*
|
|
13
|
+
* Allocates; keep it out of hot loops.
|
|
14
|
+
*/
|
|
15
|
+
export function box4Create() {
|
|
16
|
+
const out = TEMPLATE_.slice();
|
|
17
|
+
out[0] = Number.POSITIVE_INFINITY;
|
|
18
|
+
out[1] = Number.POSITIVE_INFINITY;
|
|
19
|
+
out[2] = Number.POSITIVE_INFINITY;
|
|
20
|
+
out[3] = Number.POSITIVE_INFINITY;
|
|
21
|
+
out[4] = Number.NEGATIVE_INFINITY;
|
|
22
|
+
out[5] = Number.NEGATIVE_INFINITY;
|
|
23
|
+
out[6] = Number.NEGATIVE_INFINITY;
|
|
24
|
+
out[7] = Number.NEGATIVE_INFINITY;
|
|
25
|
+
return out;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Creates the box with the components `minX, minY, minZ, minW, maxX, maxY,
|
|
29
|
+
* maxZ, maxW`, in storage order.
|
|
30
|
+
*
|
|
31
|
+
* Allocates; keep it out of hot loops.
|
|
32
|
+
*/
|
|
33
|
+
export function box4Of(minX, minY, minZ, minW, maxX, maxY, maxZ, maxW) {
|
|
34
|
+
const out = TEMPLATE_.slice();
|
|
35
|
+
out[0] = minX;
|
|
36
|
+
out[1] = minY;
|
|
37
|
+
out[2] = minZ;
|
|
38
|
+
out[3] = minW;
|
|
39
|
+
out[4] = maxX;
|
|
40
|
+
out[5] = maxY;
|
|
41
|
+
out[6] = maxZ;
|
|
42
|
+
out[7] = maxW;
|
|
43
|
+
return out;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Creates a copy of `a`. Like every creator it starts from a clean array.
|
|
47
|
+
*
|
|
48
|
+
* Allocates; keep it out of hot loops.
|
|
49
|
+
*/
|
|
50
|
+
export function box4Clone(a) {
|
|
51
|
+
const out = TEMPLATE_.slice();
|
|
52
|
+
out[0] = a[0];
|
|
53
|
+
out[1] = a[1];
|
|
54
|
+
out[2] = a[2];
|
|
55
|
+
out[3] = a[3];
|
|
56
|
+
out[4] = a[4];
|
|
57
|
+
out[5] = a[5];
|
|
58
|
+
out[6] = a[6];
|
|
59
|
+
out[7] = a[7];
|
|
60
|
+
return out;
|
|
61
|
+
}
|
|
62
|
+
/** Writes the components, in storage order, into `out`. */
|
|
63
|
+
export function box4Set(out, minX, minY, minZ, minW, maxX, maxY, maxZ, maxW) {
|
|
64
|
+
out[0] = minX;
|
|
65
|
+
out[1] = minY;
|
|
66
|
+
out[2] = minZ;
|
|
67
|
+
out[3] = minW;
|
|
68
|
+
out[4] = maxX;
|
|
69
|
+
out[5] = maxY;
|
|
70
|
+
out[6] = maxZ;
|
|
71
|
+
out[7] = maxW;
|
|
72
|
+
return out;
|
|
73
|
+
}
|
|
74
|
+
/** Writes a copy of `a` into `out`. `out` may be `a`. */
|
|
75
|
+
export function box4Copy(out, a) {
|
|
76
|
+
out[0] = a[0];
|
|
77
|
+
out[1] = a[1];
|
|
78
|
+
out[2] = a[2];
|
|
79
|
+
out[3] = a[3];
|
|
80
|
+
out[4] = a[4];
|
|
81
|
+
out[5] = a[5];
|
|
82
|
+
out[6] = a[6];
|
|
83
|
+
out[7] = a[7];
|
|
84
|
+
return out;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Exact component-wise equality: `−0` equals `+0`, `NaN` equals nothing, itself
|
|
88
|
+
* included, and an infinity equals itself. See {@link box4IsClose} for a
|
|
89
|
+
* tolerant test.
|
|
90
|
+
*/
|
|
91
|
+
export function box4Equals(a, b) {
|
|
92
|
+
return (a[0] === b[0] &&
|
|
93
|
+
a[1] === b[1] &&
|
|
94
|
+
a[2] === b[2] &&
|
|
95
|
+
a[3] === b[3] &&
|
|
96
|
+
a[4] === b[4] &&
|
|
97
|
+
a[5] === b[5] &&
|
|
98
|
+
a[6] === b[6] &&
|
|
99
|
+
a[7] === b[7]);
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Component-wise approximate equality: every pair differs by at most
|
|
103
|
+
* `tolerance`, an absolute bound in the caller's units, and an infinity is
|
|
104
|
+
* close only to itself. Not transitive, so never a basis for ordering or a
|
|
105
|
+
* container key: use {@link box4Equals} there.
|
|
106
|
+
*
|
|
107
|
+
* @param tolerance Defaults to `geometryConfig.defaultLinearTolerance`.
|
|
108
|
+
*/
|
|
109
|
+
export function box4IsClose(a, b, tolerance = geometryConfig.defaultLinearTolerance) {
|
|
110
|
+
return (isCloseAbsolute(a[0], b[0], tolerance) &&
|
|
111
|
+
isCloseAbsolute(a[1], b[1], tolerance) &&
|
|
112
|
+
isCloseAbsolute(a[2], b[2], tolerance) &&
|
|
113
|
+
isCloseAbsolute(a[3], b[3], tolerance) &&
|
|
114
|
+
isCloseAbsolute(a[4], b[4], tolerance) &&
|
|
115
|
+
isCloseAbsolute(a[5], b[5], tolerance) &&
|
|
116
|
+
isCloseAbsolute(a[6], b[6], tolerance) &&
|
|
117
|
+
isCloseAbsolute(a[7], b[7], tolerance));
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* The checked way in from untyped data (JSON, messages, arrays of unknown
|
|
121
|
+
* origin): `source[offset … offset + 8)` copied into `out`, each element that
|
|
122
|
+
* is not a number written as `NaN`, an index past the end of `source` too, so
|
|
123
|
+
* `out` never holds a non-number. A cold path: buffers use {@link box4Load}.
|
|
124
|
+
* O(1).
|
|
125
|
+
*
|
|
126
|
+
* `source` may be `out` itself: the 8 elements are read before the first write.
|
|
127
|
+
*
|
|
128
|
+
* @param out The box to fill.
|
|
129
|
+
* @param source The array to read, of any length and any content.
|
|
130
|
+
* @param offset The index of the first component in `source`.
|
|
131
|
+
* @returns `out`.
|
|
132
|
+
*/
|
|
133
|
+
export function box4FromArray(out, source, offset = 0) {
|
|
134
|
+
const value0 = numberAtOrNaN(source, offset);
|
|
135
|
+
const value1 = numberAtOrNaN(source, offset + 1);
|
|
136
|
+
const value2 = numberAtOrNaN(source, offset + 2);
|
|
137
|
+
const value3 = numberAtOrNaN(source, offset + 3);
|
|
138
|
+
const value4 = numberAtOrNaN(source, offset + 4);
|
|
139
|
+
const value5 = numberAtOrNaN(source, offset + 5);
|
|
140
|
+
const value6 = numberAtOrNaN(source, offset + 6);
|
|
141
|
+
const value7 = numberAtOrNaN(source, offset + 7);
|
|
142
|
+
out[0] = value0;
|
|
143
|
+
out[1] = value1;
|
|
144
|
+
out[2] = value2;
|
|
145
|
+
out[3] = value3;
|
|
146
|
+
out[4] = value4;
|
|
147
|
+
out[5] = value5;
|
|
148
|
+
out[6] = value6;
|
|
149
|
+
out[7] = value7;
|
|
150
|
+
return out;
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Whether every component is a finite number: the check to run after parsing
|
|
154
|
+
* untrusted data or before an upload, as operations never check. A component
|
|
155
|
+
* that is not a number at all counts as not finite.
|
|
156
|
+
*/
|
|
157
|
+
export function box4IsFinite(value) {
|
|
158
|
+
return (Number.isFinite(value[0]) &&
|
|
159
|
+
Number.isFinite(value[1]) &&
|
|
160
|
+
Number.isFinite(value[2]) &&
|
|
161
|
+
Number.isFinite(value[3]) &&
|
|
162
|
+
Number.isFinite(value[4]) &&
|
|
163
|
+
Number.isFinite(value[5]) &&
|
|
164
|
+
Number.isFinite(value[6]) &&
|
|
165
|
+
Number.isFinite(value[7]));
|
|
166
|
+
}
|
|
167
|
+
//# sourceMappingURL=box4-record.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"box4-record.js","sourceRoot":"","sources":["../src/box4-record.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAE9F,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAG9D,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAwC9C;;;GAGG;AACH,MAAM,SAAS,GAAsB,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;AAE9E;;;;;GAKG;AACH,MAAM,UAAU,UAAU;IACzB,MAAM,GAAG,GAAG,SAAS,CAAC,KAAK,EAAU,CAAC;IACtC,GAAG,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,iBAAiB,CAAC;IAClC,GAAG,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,iBAAiB,CAAC;IAClC,GAAG,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,iBAAiB,CAAC;IAClC,GAAG,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,iBAAiB,CAAC;IAClC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C,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,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;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/box4.d.ts
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import type { Vec2 } from "@ac-kit/math-linear";
|
|
2
|
+
import type { Box3 } from "./box3-record.js";
|
|
3
|
+
import type { ReadonlyBox4 } from "./box4-record.js";
|
|
4
|
+
/**
|
|
5
|
+
* The content of the box in four dimensions: the product of the four extents,
|
|
6
|
+
* `0` for an empty box. The fourth axis is often time, so this is a space-time
|
|
7
|
+
* volume.
|
|
8
|
+
*/
|
|
9
|
+
export declare function box4Hypervolume(box: ReadonlyBox4): number;
|
|
10
|
+
/** Writes the box of the first three axes into `out`, dropping the fourth. */
|
|
11
|
+
export declare function box3FromBox4(out: Box3, box: ReadonlyBox4): Box3;
|
|
12
|
+
/** Writes the interval `[minW, maxW]` of the fourth axis into `out`. */
|
|
13
|
+
export declare function box4IntervalW(out: Vec2, box: ReadonlyBox4): Vec2;
|
|
9
14
|
//# sourceMappingURL=box4.d.ts.map
|
package/dist/box4.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"box4.d.ts","sourceRoot":"","sources":["../src/box4.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"box4.d.ts","sourceRoot":"","sources":["../src/box4.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAEhD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAErD;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,YAAY,GAAG,MAAM,CAMzD;AAED,8EAA8E;AAC9E,wBAAgB,YAAY,CAAC,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,GAAG,IAAI,CAQ/D;AAED,wEAAwE;AACxE,wBAAgB,aAAa,CAAC,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,GAAG,IAAI,CAIhE"}
|
package/dist/box4.js
CHANGED
|
@@ -1,7 +1,29 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
/**
|
|
2
|
+
* The content of the box in four dimensions: the product of the four extents,
|
|
3
|
+
* `0` for an empty box. The fourth axis is often time, so this is a space-time
|
|
4
|
+
* volume.
|
|
5
|
+
*/
|
|
6
|
+
export function box4Hypervolume(box) {
|
|
7
|
+
const x = box[4] - box[0];
|
|
8
|
+
const y = box[5] - box[1];
|
|
9
|
+
const z = box[6] - box[2];
|
|
10
|
+
const w = box[7] - box[3];
|
|
11
|
+
return x < 0 || y < 0 || z < 0 || w < 0 ? 0 : x * y * z * w;
|
|
12
|
+
}
|
|
13
|
+
/** Writes the box of the first three axes into `out`, dropping the fourth. */
|
|
14
|
+
export function box3FromBox4(out, box) {
|
|
15
|
+
out[0] = box[0];
|
|
16
|
+
out[1] = box[1];
|
|
17
|
+
out[2] = box[2];
|
|
18
|
+
out[3] = box[4];
|
|
19
|
+
out[4] = box[5];
|
|
20
|
+
out[5] = box[6];
|
|
21
|
+
return out;
|
|
22
|
+
}
|
|
23
|
+
/** Writes the interval `[minW, maxW]` of the fourth axis into `out`. */
|
|
24
|
+
export function box4IntervalW(out, box) {
|
|
25
|
+
out[0] = box[3];
|
|
26
|
+
out[1] = box[7];
|
|
27
|
+
return out;
|
|
6
28
|
}
|
|
7
29
|
//# sourceMappingURL=box4.js.map
|
package/dist/box4.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"box4.js","sourceRoot":"","sources":["../src/box4.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"box4.js","sourceRoot":"","sources":["../src/box4.ts"],"names":[],"mappings":"AAKA;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAAC,GAAiB;IAChD,MAAM,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;IAC1B,MAAM,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;IAC1B,MAAM,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;IAC1B,MAAM,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;IAC1B,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAC7D,CAAC;AAED,8EAA8E;AAC9E,MAAM,UAAU,YAAY,CAAC,GAAS,EAAE,GAAiB;IACxD,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;IAChB,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;IAChB,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;IAChB,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;IAChB,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;IAChB,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;IAChB,OAAO,GAAG,CAAC;AACZ,CAAC;AAED,wEAAwE;AACxE,MAAM,UAAU,aAAa,CAAC,GAAS,EAAE,GAAiB;IACzD,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;IAChB,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;IAChB,OAAO,GAAG,CAAC;AACZ,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { ReadonlyCircle2, Circle2 } from "./circle2-record.js";
|
|
2
|
+
/**
|
|
3
|
+
* Creates a buffer for `count` circles: a zero-filled `Float64Array` of `count
|
|
4
|
+
* × 3` numbers, element `i` at `[i·3, i·3 + 3)`. Allocates.
|
|
5
|
+
*
|
|
6
|
+
* @throws {RangeError} When `count` is not a non-negative safe integer or
|
|
7
|
+
* `count × 3` is not a valid typed array length.
|
|
8
|
+
*/
|
|
9
|
+
export declare function circle2ArrayCreate(count: number): Float64Array<ArrayBuffer>;
|
|
10
|
+
/**
|
|
11
|
+
* Writes element `index` of `array`, the numbers at `[index·3, index·3 + 3)`,
|
|
12
|
+
* into `out`. Each component is written as `+array[i]`, so an index past the
|
|
13
|
+
* end of `array` gives `NaN`, never `undefined`: the circle stays clean
|
|
14
|
+
* whatever the caller does. Checking the index is the job of the checked
|
|
15
|
+
* layer.
|
|
16
|
+
*
|
|
17
|
+
* The circle is copied: it is never a view of `array`. O(1).
|
|
18
|
+
*/
|
|
19
|
+
export declare function circle2Load(out: Circle2, array: Float64Array, index: number): Circle2;
|
|
20
|
+
/**
|
|
21
|
+
* Writes `value` into `array` as element `index`, at `[index·3, index·3 + 3)`.
|
|
22
|
+
* An element past the end of `array` writes nothing, as a typed array drops an
|
|
23
|
+
* out-of-range write. O(1).
|
|
24
|
+
*/
|
|
25
|
+
export declare function circle2Store(array: Float64Array, index: number, value: ReadonlyCircle2): void;
|
|
26
|
+
/**
|
|
27
|
+
* Like {@link circle2Load} for interleaved data: element `index` starts at
|
|
28
|
+
* `offset + index·stride`, both counted in numbers, and its 3 components follow
|
|
29
|
+
* one another. An index past the end gives `NaN` components. O(1).
|
|
30
|
+
*/
|
|
31
|
+
export declare function circle2LoadStrided(out: Circle2, array: Float64Array, offset: number, stride: number, index: number): Circle2;
|
|
32
|
+
/**
|
|
33
|
+
* Like {@link circle2Store} for interleaved data: element `index` starts at
|
|
34
|
+
* `offset + index·stride`, both counted in numbers. A component past the end of
|
|
35
|
+
* `array` writes nothing. O(1).
|
|
36
|
+
*/
|
|
37
|
+
export declare function circle2StoreStrided(array: Float64Array, offset: number, stride: number, index: number, value: ReadonlyCircle2): void;
|
|
38
|
+
/**
|
|
39
|
+
* Narrows `value` to binary32 and writes its 3 components into `array` from
|
|
40
|
+
* element `offset` on, unrolled: the way to stage a bounds or instance value
|
|
41
|
+
* for the GPU, where `array.set` costs several times as much for one value. A
|
|
42
|
+
* component past the end of `array` writes nothing. O(1).
|
|
43
|
+
*/
|
|
44
|
+
export declare function circle2StoreFloat32(array: Float32Array, offset: number, value: ReadonlyCircle2): void;
|
|
45
|
+
/**
|
|
46
|
+
* Whether every number of `array` is finite: the check for a buffer of circle2
|
|
47
|
+
* elements read from untrusted data or about to be uploaded. The length is not
|
|
48
|
+
* required to be a multiple of 3. O(n).
|
|
49
|
+
*/
|
|
50
|
+
export declare function circle2ArrayIsFinite(array: Float64Array): boolean;
|
|
51
|
+
//# sourceMappingURL=circle2-array-boundary.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"circle2-array-boundary.d.ts","sourceRoot":"","sources":["../src/circle2-array-boundary.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAEpE;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,YAAY,CAAC,WAAW,CAAC,CAG3E;AAED;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CAC1B,GAAG,EAAE,OAAO,EACZ,KAAK,EAAE,YAAY,EACnB,KAAK,EAAE,MAAM,GACX,OAAO,CAOT;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAC3B,KAAK,EAAE,YAAY,EACnB,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,eAAe,GACpB,IAAI,CAKN;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CACjC,GAAG,EAAE,OAAO,EACZ,KAAK,EAAE,YAAY,EACnB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,GACX,OAAO,CAOT;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAClC,KAAK,EAAE,YAAY,EACnB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,eAAe,GACpB,IAAI,CAKN;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAClC,KAAK,EAAE,YAAY,EACnB,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,eAAe,GACpB,IAAI,CAIN;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO,CAUjE"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
// Generated from scripts/templates/array-boundary.liquid by scripts/generate-records.ts. Do not edit.
|
|
2
|
+
import { assertInteger } from "@ac-kit/core";
|
|
3
|
+
/**
|
|
4
|
+
* Creates a buffer for `count` circles: a zero-filled `Float64Array` of `count
|
|
5
|
+
* × 3` numbers, element `i` at `[i·3, i·3 + 3)`. Allocates.
|
|
6
|
+
*
|
|
7
|
+
* @throws {RangeError} When `count` is not a non-negative safe integer or
|
|
8
|
+
* `count × 3` is not a valid typed array length.
|
|
9
|
+
*/
|
|
10
|
+
export function circle2ArrayCreate(count) {
|
|
11
|
+
assertInteger(count, "circle2ArrayCreate: count", 0);
|
|
12
|
+
return new Float64Array(count * 3);
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Writes element `index` of `array`, the numbers at `[index·3, index·3 + 3)`,
|
|
16
|
+
* into `out`. Each component is written as `+array[i]`, so an index past the
|
|
17
|
+
* end of `array` gives `NaN`, never `undefined`: the circle stays clean
|
|
18
|
+
* whatever the caller does. Checking the index is the job of the checked
|
|
19
|
+
* layer.
|
|
20
|
+
*
|
|
21
|
+
* The circle is copied: it is never a view of `array`. O(1).
|
|
22
|
+
*/
|
|
23
|
+
export function circle2Load(out, array, index) {
|
|
24
|
+
const base = index * 3;
|
|
25
|
+
// The `!` is for the compiler: past the end `+undefined` is `NaN`.
|
|
26
|
+
out[0] = +array[base];
|
|
27
|
+
out[1] = +array[base + 1];
|
|
28
|
+
out[2] = +array[base + 2];
|
|
29
|
+
return out;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Writes `value` into `array` as element `index`, at `[index·3, index·3 + 3)`.
|
|
33
|
+
* An element past the end of `array` writes nothing, as a typed array drops an
|
|
34
|
+
* out-of-range write. O(1).
|
|
35
|
+
*/
|
|
36
|
+
export function circle2Store(array, index, value) {
|
|
37
|
+
const base = index * 3;
|
|
38
|
+
array[base] = value[0];
|
|
39
|
+
array[base + 1] = value[1];
|
|
40
|
+
array[base + 2] = value[2];
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Like {@link circle2Load} for interleaved data: element `index` starts at
|
|
44
|
+
* `offset + index·stride`, both counted in numbers, and its 3 components follow
|
|
45
|
+
* one another. An index past the end gives `NaN` components. O(1).
|
|
46
|
+
*/
|
|
47
|
+
export function circle2LoadStrided(out, array, offset, stride, index) {
|
|
48
|
+
const base = offset + index * stride;
|
|
49
|
+
// The `!` is for the compiler: past the end `+undefined` is `NaN`.
|
|
50
|
+
out[0] = +array[base];
|
|
51
|
+
out[1] = +array[base + 1];
|
|
52
|
+
out[2] = +array[base + 2];
|
|
53
|
+
return out;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Like {@link circle2Store} for interleaved data: element `index` starts at
|
|
57
|
+
* `offset + index·stride`, both counted in numbers. A component past the end of
|
|
58
|
+
* `array` writes nothing. O(1).
|
|
59
|
+
*/
|
|
60
|
+
export function circle2StoreStrided(array, offset, stride, index, value) {
|
|
61
|
+
const base = offset + index * stride;
|
|
62
|
+
array[base] = value[0];
|
|
63
|
+
array[base + 1] = value[1];
|
|
64
|
+
array[base + 2] = value[2];
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Narrows `value` to binary32 and writes its 3 components into `array` from
|
|
68
|
+
* element `offset` on, unrolled: the way to stage a bounds or instance value
|
|
69
|
+
* for the GPU, where `array.set` costs several times as much for one value. A
|
|
70
|
+
* component past the end of `array` writes nothing. O(1).
|
|
71
|
+
*/
|
|
72
|
+
export function circle2StoreFloat32(array, offset, value) {
|
|
73
|
+
array[offset] = value[0];
|
|
74
|
+
array[offset + 1] = value[1];
|
|
75
|
+
array[offset + 2] = value[2];
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Whether every number of `array` is finite: the check for a buffer of circle2
|
|
79
|
+
* elements read from untrusted data or about to be uploaded. The length is not
|
|
80
|
+
* required to be a multiple of 3. O(n).
|
|
81
|
+
*/
|
|
82
|
+
export function circle2ArrayIsFinite(array) {
|
|
83
|
+
// A loop, not `array.every(Number.isFinite)`: measured at 0.5–0.7 ms against
|
|
84
|
+
// 4.1 ms per million numbers on Node (the callback is not inlined), and the
|
|
85
|
+
// check runs on every upload of an untrusted buffer.
|
|
86
|
+
for (let index = 0; index < array.length; index++) {
|
|
87
|
+
if (!Number.isFinite(array[index])) {
|
|
88
|
+
return false;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
return true;
|
|
92
|
+
}
|
|
93
|
+
//# sourceMappingURL=circle2-array-boundary.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"circle2-array-boundary.js","sourceRoot":"","sources":["../src/circle2-array-boundary.ts"],"names":[],"mappings":"AAAA,sGAAsG;AAEtG,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAI7C;;;;;;GAMG;AACH,MAAM,UAAU,kBAAkB,CAAC,KAAa;IAC/C,aAAa,CAAC,KAAK,EAAE,2BAA2B,EAAE,CAAC,CAAC,CAAC;IACrD,OAAO,IAAI,YAAY,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;AACpC,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,WAAW,CAC1B,GAAY,EACZ,KAAmB,EACnB,KAAa;IAEb,MAAM,IAAI,GAAG,KAAK,GAAG,CAAC,CAAC;IACvB,mEAAmE;IACnE,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAE,CAAC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AAC,CAAC,CAAC;IACvB,KAAK,CAAC,IAAI,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;IAC3B,KAAK,CAAC,IAAI,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;AAC5B,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,mBAAmB,CAClC,KAAmB,EACnB,MAAc,EACd,KAAsB;IAEtB,KAAK,CAAC,MAAM,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;IACzB,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;IAC7B,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;AAC9B,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,oBAAoB,CAAC,KAAmB;IACvD,6EAA6E;IAC7E,4EAA4E;IAC5E,qDAAqD;IACrD,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC;QACnD,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC;YACpC,OAAO,KAAK,CAAC;QACd,CAAC;IACF,CAAC;IACD,OAAO,IAAI,CAAC;AACb,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The index, counted in circles, of the first circle (`[centerX, centerY,
|
|
3
|
+
* radius]` per circle in a `Float64Array`) that contains the point `(x, y)`,
|
|
4
|
+
* boundary included, or `−1`. O(n).
|
|
5
|
+
*
|
|
6
|
+
* @throws {RangeError} When `circles.length` is not a multiple of 3.
|
|
7
|
+
*/
|
|
8
|
+
export declare function circle2ArrayFindIndexContainingXy(circles: Float64Array, x: number, y: number): number;
|
|
9
|
+
/**
|
|
10
|
+
* The index of the last circle that contains the point `(x, y)`, boundary
|
|
11
|
+
* included, or `−1`: the topmost one when later circles are drawn over earlier
|
|
12
|
+
* ones. O(n).
|
|
13
|
+
*
|
|
14
|
+
* @throws {RangeError} When `circles.length` is not a multiple of 3.
|
|
15
|
+
*/
|
|
16
|
+
export declare function circle2ArrayFindLastIndexContainingXy(circles: Float64Array, x: number, y: number): number;
|
|
17
|
+
//# sourceMappingURL=circle2-array.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"circle2-array.d.ts","sourceRoot":"","sources":["../src/circle2-array.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,wBAAgB,iCAAiC,CAChD,OAAO,EAAE,YAAY,EACrB,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,GACP,MAAM,CAQR;AAED;;;;;;GAMG;AACH,wBAAgB,qCAAqC,CACpD,OAAO,EAAE,YAAY,EACrB,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,GACP,MAAM,CAQR"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The index, counted in circles, of the first circle (`[centerX, centerY,
|
|
3
|
+
* radius]` per circle in a `Float64Array`) that contains the point `(x, y)`,
|
|
4
|
+
* boundary included, or `−1`. O(n).
|
|
5
|
+
*
|
|
6
|
+
* @throws {RangeError} When `circles.length` is not a multiple of 3.
|
|
7
|
+
*/
|
|
8
|
+
export function circle2ArrayFindIndexContainingXy(circles, x, y) {
|
|
9
|
+
assertWholeCircles_("circle2ArrayFindIndexContainingXy", circles);
|
|
10
|
+
for (let offset = 0; offset < circles.length; offset += 3) {
|
|
11
|
+
if (containsXy_(circles, offset, x, y)) {
|
|
12
|
+
return offset / 3;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
return -1;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* The index of the last circle that contains the point `(x, y)`, boundary
|
|
19
|
+
* included, or `−1`: the topmost one when later circles are drawn over earlier
|
|
20
|
+
* ones. O(n).
|
|
21
|
+
*
|
|
22
|
+
* @throws {RangeError} When `circles.length` is not a multiple of 3.
|
|
23
|
+
*/
|
|
24
|
+
export function circle2ArrayFindLastIndexContainingXy(circles, x, y) {
|
|
25
|
+
assertWholeCircles_("circle2ArrayFindLastIndexContainingXy", circles);
|
|
26
|
+
for (let offset = circles.length - 3; offset >= 0; offset -= 3) {
|
|
27
|
+
if (containsXy_(circles, offset, x, y)) {
|
|
28
|
+
return offset / 3;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return -1;
|
|
32
|
+
}
|
|
33
|
+
function assertWholeCircles_(name, circles) {
|
|
34
|
+
if (circles.length % 3 !== 0) {
|
|
35
|
+
throw new RangeError(`${name}: circles has ${circles.length} numbers, not a multiple of 3.`);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
function containsXy_(circles, offset, x, y) {
|
|
39
|
+
const dx = x - circles[offset];
|
|
40
|
+
const dy = y - circles[offset + 1];
|
|
41
|
+
const radius = circles[offset + 2];
|
|
42
|
+
return radius >= 0 && dx * dx + dy * dy <= radius * radius;
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=circle2-array.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"circle2-array.js","sourceRoot":"","sources":["../src/circle2-array.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,UAAU,iCAAiC,CAChD,OAAqB,EACrB,CAAS,EACT,CAAS;IAET,mBAAmB,CAAC,mCAAmC,EAAE,OAAO,CAAC,CAAC;IAClE,KAAK,IAAI,MAAM,GAAG,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,MAAM,IAAI,CAAC,EAAE,CAAC;QAC3D,IAAI,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC;YACxC,OAAO,MAAM,GAAG,CAAC,CAAC;QACnB,CAAC;IACF,CAAC;IACD,OAAO,CAAC,CAAC,CAAC;AACX,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,qCAAqC,CACpD,OAAqB,EACrB,CAAS,EACT,CAAS;IAET,mBAAmB,CAAC,uCAAuC,EAAE,OAAO,CAAC,CAAC;IACtE,KAAK,IAAI,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,MAAM,IAAI,CAAC,EAAE,MAAM,IAAI,CAAC,EAAE,CAAC;QAChE,IAAI,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC;YACxC,OAAO,MAAM,GAAG,CAAC,CAAC;QACnB,CAAC;IACF,CAAC;IACD,OAAO,CAAC,CAAC,CAAC;AACX,CAAC;AAED,SAAS,mBAAmB,CAAC,IAAY,EAAE,OAAqB;IAC/D,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC;QAC9B,MAAM,IAAI,UAAU,CACnB,GAAG,IAAI,iBAAiB,OAAO,CAAC,MAAM,gCAAgC,CACtE,CAAC;IACH,CAAC;AACF,CAAC;AAED,SAAS,WAAW,CACnB,OAAqB,EACrB,MAAc,EACd,CAAS,EACT,CAAS;IAET,MAAM,EAAE,GAAG,CAAC,GAAG,OAAO,CAAC,MAAM,CAAE,CAAC;IAChC,MAAM,EAAE,GAAG,CAAC,GAAG,OAAO,CAAC,MAAM,GAAG,CAAC,CAAE,CAAC;IACpC,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,CAAC,CAAE,CAAC;IACpC,OAAO,MAAM,IAAI,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,MAAM,GAAG,MAAM,CAAC;AAC5D,CAAC"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import type { Brand_ } from "./_brand.js";
|
|
2
|
+
/**
|
|
3
|
+
* A circle (a disc, for the containment tests) in the plane: its centre then
|
|
4
|
+
* its radius. A negative radius makes the circle empty.
|
|
5
|
+
*
|
|
6
|
+
* A plain array of 3 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 circle2Create}, {@link circle2Of}, {@link circle2Clone},
|
|
11
|
+
* {@link circle2FromArray} and the functions that write an `out` make one; see
|
|
12
|
+
* `Vec3` in `@ac-kit/math-linear` for the rules that bind callers who bypass
|
|
13
|
+
* the types.
|
|
14
|
+
*/
|
|
15
|
+
export type Circle2 = [centerX: number, centerY: number, radius: number] & Brand_<"Circle2">;
|
|
16
|
+
/** A {@link Circle2} that is only read. */
|
|
17
|
+
export type ReadonlyCircle2 = readonly [
|
|
18
|
+
centerX: number,
|
|
19
|
+
centerY: number,
|
|
20
|
+
radius: number
|
|
21
|
+
] & Brand_<"Circle2">;
|
|
22
|
+
/**
|
|
23
|
+
* Creates the circle of radius 0 at the origin.
|
|
24
|
+
*
|
|
25
|
+
* Allocates; keep it out of hot loops.
|
|
26
|
+
*/
|
|
27
|
+
export declare function circle2Create(): Circle2;
|
|
28
|
+
/**
|
|
29
|
+
* Creates the circle with the components `centerX, centerY, radius`, in storage
|
|
30
|
+
* order.
|
|
31
|
+
*
|
|
32
|
+
* Allocates; keep it out of hot loops.
|
|
33
|
+
*/
|
|
34
|
+
export declare function circle2Of(centerX: number, centerY: number, radius: number): Circle2;
|
|
35
|
+
/**
|
|
36
|
+
* Creates a copy of `a`. Like every creator it starts from a clean array.
|
|
37
|
+
*
|
|
38
|
+
* Allocates; keep it out of hot loops.
|
|
39
|
+
*/
|
|
40
|
+
export declare function circle2Clone(a: ReadonlyCircle2): Circle2;
|
|
41
|
+
/** Writes the components, in storage order, into `out`. */
|
|
42
|
+
export declare function circle2Set(out: Circle2, centerX: number, centerY: number, radius: number): Circle2;
|
|
43
|
+
/** Writes a copy of `a` into `out`. `out` may be `a`. */
|
|
44
|
+
export declare function circle2Copy(out: Circle2, a: ReadonlyCircle2): Circle2;
|
|
45
|
+
/**
|
|
46
|
+
* Exact component-wise equality: `−0` equals `+0`, `NaN` equals nothing, itself
|
|
47
|
+
* included, and an infinity equals itself. See {@link circle2IsClose} for a
|
|
48
|
+
* tolerant test.
|
|
49
|
+
*/
|
|
50
|
+
export declare function circle2Equals(a: ReadonlyCircle2, b: ReadonlyCircle2): boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Component-wise approximate equality: every pair differs by at most
|
|
53
|
+
* `tolerance`, an absolute bound in the caller's units, and an infinity is
|
|
54
|
+
* close only to itself. Not transitive, so never a basis for ordering or a
|
|
55
|
+
* container key: use {@link circle2Equals} there.
|
|
56
|
+
*
|
|
57
|
+
* @param tolerance Defaults to `geometryConfig.defaultLinearTolerance`.
|
|
58
|
+
*/
|
|
59
|
+
export declare function circle2IsClose(a: ReadonlyCircle2, b: ReadonlyCircle2, tolerance?: number): boolean;
|
|
60
|
+
/**
|
|
61
|
+
* The checked way in from untyped data (JSON, messages, arrays of unknown
|
|
62
|
+
* origin): `source[offset … offset + 3)` copied into `out`, each element that
|
|
63
|
+
* is not a number written as `NaN`, an index past the end of `source` too, so
|
|
64
|
+
* `out` never holds a non-number. A cold path: buffers use {@link circle2Load}.
|
|
65
|
+
* O(1).
|
|
66
|
+
*
|
|
67
|
+
* `source` may be `out` itself: the 3 elements are read before the first write.
|
|
68
|
+
*
|
|
69
|
+
* @param out The circle to fill.
|
|
70
|
+
* @param source The array to read, of any length and any content.
|
|
71
|
+
* @param offset The index of the first component in `source`.
|
|
72
|
+
* @returns `out`.
|
|
73
|
+
*/
|
|
74
|
+
export declare function circle2FromArray(out: Circle2, source: ArrayLike<number>, offset?: number): Circle2;
|
|
75
|
+
/**
|
|
76
|
+
* Whether every component is a finite number: the check to run after parsing
|
|
77
|
+
* untrusted data or before an upload, as operations never check. A component
|
|
78
|
+
* that is not a number at all counts as not finite.
|
|
79
|
+
*/
|
|
80
|
+
export declare function circle2IsFinite(value: ReadonlyCircle2): boolean;
|
|
81
|
+
//# sourceMappingURL=circle2-record.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"circle2-record.d.ts","sourceRoot":"","sources":["../src/circle2-record.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAG1C;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,OAAO,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,GACvE,MAAM,CAAC,SAAS,CAAC,CAAC;AAEnB,2CAA2C;AAC3C,MAAM,MAAM,eAAe,GAAG,SAAS;IACtC,OAAO,EAAE,MAAM;IACf,OAAO,EAAE,MAAM;IACf,MAAM,EAAE,MAAM;CACd,GACA,MAAM,CAAC,SAAS,CAAC,CAAC;AAQnB;;;;GAIG;AACH,wBAAgB,aAAa,IAAI,OAAO,CAMvC;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,CACxB,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,GACZ,OAAO,CAMT;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAAE,eAAe,GAAG,OAAO,CAMxD;AAED,2DAA2D;AAC3D,wBAAgB,UAAU,CACzB,GAAG,EAAE,OAAO,EACZ,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,GACZ,OAAO,CAKT;AAED,yDAAyD;AACzD,wBAAgB,WAAW,CAAC,GAAG,EAAE,OAAO,EAAE,CAAC,EAAE,eAAe,GAAG,OAAO,CAKrE;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAAE,eAAe,EAAE,CAAC,EAAE,eAAe,GAAG,OAAO,CAE7E;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAC7B,CAAC,EAAE,eAAe,EAClB,CAAC,EAAE,eAAe,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