math 0.0.3 → 0.1.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/API.md +1605 -0
- package/LICENSE +21 -0
- package/README.md +197 -0
- package/dist/color/color.js +136 -0
- package/dist/color/color.js.map +1 -0
- package/dist/color/colorspace.js +43 -0
- package/dist/color/colorspace.js.map +1 -0
- package/dist/color/hsl.js +123 -0
- package/dist/color/hsl.js.map +1 -0
- package/dist/color/index.js +7 -0
- package/dist/color/index.js.map +1 -0
- package/dist/color/parse.js +276 -0
- package/dist/color/parse.js.map +1 -0
- package/dist/core/angle.js +43 -0
- package/dist/core/angle.js.map +1 -0
- package/dist/core/euler.js +212 -0
- package/dist/core/euler.js.map +1 -0
- package/dist/core/mat2.js +385 -0
- package/dist/core/mat2.js.map +1 -0
- package/dist/core/mat2d.js +422 -0
- package/dist/core/mat2d.js.map +1 -0
- package/dist/core/mat3.js +749 -0
- package/dist/core/mat3.js.map +1 -0
- package/dist/core/mat4.js +2197 -0
- package/dist/core/mat4.js.map +1 -0
- package/dist/core/polar.js +200 -0
- package/dist/core/polar.js.map +1 -0
- package/dist/core/quat.js +730 -0
- package/dist/core/quat.js.map +1 -0
- package/dist/core/quat2.js +883 -0
- package/dist/core/quat2.js.map +1 -0
- package/dist/core/scalar.js +112 -0
- package/dist/core/scalar.js.map +1 -0
- package/dist/core/spherical.js +248 -0
- package/dist/core/spherical.js.map +1 -0
- package/dist/core/vec2.js +597 -0
- package/dist/core/vec2.js.map +1 -0
- package/dist/core/vec3.js +916 -0
- package/dist/core/vec3.js.map +1 -0
- package/dist/core/vec4.js +573 -0
- package/dist/core/vec4.js.map +1 -0
- package/dist/geometry/circumcircle.js +39 -0
- package/dist/geometry/circumcircle.js.map +1 -0
- package/dist/geometry/index.js +6 -0
- package/dist/geometry/index.js.map +1 -0
- package/dist/geometry/polygon2-decompose.js +411 -0
- package/dist/geometry/polygon2-decompose.js.map +1 -0
- package/dist/geometry/polygon2-triangulate.js +222 -0
- package/dist/geometry/polygon2-triangulate.js.map +1 -0
- package/dist/geometry/quickhull2.js +123 -0
- package/dist/geometry/quickhull2.js.map +1 -0
- package/dist/geometry/quickhull3.js +605 -0
- package/dist/geometry/quickhull3.js.map +1 -0
- package/dist/ik/fabrik2.js +675 -0
- package/dist/ik/fabrik2.js.map +1 -0
- package/dist/ik/fabrik3.js +912 -0
- package/dist/ik/fabrik3.js.map +1 -0
- package/dist/ik/index.js +5 -0
- package/dist/ik/index.js.map +1 -0
- package/dist/index.js +27 -0
- package/dist/index.js.map +1 -0
- package/dist/noise/fractal.js +185 -0
- package/dist/noise/fractal.js.map +1 -0
- package/dist/noise/index.js +16 -0
- package/dist/noise/index.js.map +1 -0
- package/dist/noise/perlin2d.js +50 -0
- package/dist/noise/perlin2d.js.map +1 -0
- package/dist/noise/perlin3d.js +72 -0
- package/dist/noise/perlin3d.js.map +1 -0
- package/dist/noise/permutation.js +120 -0
- package/dist/noise/permutation.js.map +1 -0
- package/dist/noise/simplex2d.js +84 -0
- package/dist/noise/simplex2d.js.map +1 -0
- package/dist/noise/simplex3d.js +147 -0
- package/dist/noise/simplex3d.js.map +1 -0
- package/dist/noise/simplex4d.js +149 -0
- package/dist/noise/simplex4d.js.map +1 -0
- package/dist/noise/worley2d.js +50 -0
- package/dist/noise/worley2d.js.map +1 -0
- package/dist/noise/worley3d.js +61 -0
- package/dist/noise/worley3d.js.map +1 -0
- package/dist/random/index.js +9 -0
- package/dist/random/index.js.map +1 -0
- package/dist/random/isaac32.js +164 -0
- package/dist/random/isaac32.js.map +1 -0
- package/dist/random/isaac64.js +215 -0
- package/dist/random/isaac64.js.map +1 -0
- package/dist/random/mulberry32.js +48 -0
- package/dist/random/mulberry32.js.map +1 -0
- package/dist/random/random.js +120 -0
- package/dist/random/random.js.map +1 -0
- package/dist/shapes/box2.js +300 -0
- package/dist/shapes/box2.js.map +1 -0
- package/dist/shapes/box3.js +550 -0
- package/dist/shapes/box3.js.map +1 -0
- package/dist/shapes/circle.js +6 -0
- package/dist/shapes/circle.js.map +1 -0
- package/dist/shapes/frustum.js +662 -0
- package/dist/shapes/frustum.js.map +1 -0
- package/dist/shapes/index.js +25 -0
- package/dist/shapes/index.js.map +1 -0
- package/dist/shapes/obb3.js +557 -0
- package/dist/shapes/obb3.js.map +1 -0
- package/dist/shapes/plane3.js +267 -0
- package/dist/shapes/plane3.js.map +1 -0
- package/dist/shapes/polygon2.js +451 -0
- package/dist/shapes/polygon2.js.map +1 -0
- package/dist/shapes/raycast3.js +164 -0
- package/dist/shapes/raycast3.js.map +1 -0
- package/dist/shapes/segment2.js +82 -0
- package/dist/shapes/segment2.js.map +1 -0
- package/dist/shapes/sphere.js +23 -0
- package/dist/shapes/sphere.js.map +1 -0
- package/dist/shapes/triangle2.js +79 -0
- package/dist/shapes/triangle2.js.map +1 -0
- package/dist/shapes/triangle3.js +60 -0
- package/dist/shapes/triangle3.js.map +1 -0
- package/dist/src/color/color.d.ts +50 -0
- package/dist/src/color/colorspace.d.ts +15 -0
- package/dist/src/color/hsl.d.ts +28 -0
- package/dist/src/color/index.d.ts +5 -0
- package/dist/src/color/parse.d.ts +15 -0
- package/dist/src/core/angle.d.ts +29 -0
- package/dist/src/core/arrays.d.ts +4 -0
- package/dist/src/core/euler.d.ts +78 -0
- package/dist/src/core/index.d.ts +27 -0
- package/dist/src/core/mat2.d.ts +217 -0
- package/dist/src/core/mat2d.d.ts +218 -0
- package/dist/src/core/mat3.d.ts +295 -0
- package/dist/src/core/mat4.d.ts +667 -0
- package/dist/src/core/polar.d.ts +151 -0
- package/dist/src/core/quat.d.ts +370 -0
- package/dist/src/core/quat2.d.ts +344 -0
- package/dist/src/core/scalar.d.ts +75 -0
- package/dist/src/core/spherical.d.ts +165 -0
- package/dist/src/core/vec2.d.ts +403 -0
- package/dist/src/core/vec3.d.ts +493 -0
- package/dist/src/core/vec4.d.ts +336 -0
- package/dist/src/geometry/circumcircle.d.ts +9 -0
- package/dist/src/geometry/index.d.ts +5 -0
- package/dist/src/geometry/polygon2-decompose.d.ts +25 -0
- package/dist/src/geometry/polygon2-triangulate.d.ts +15 -0
- package/dist/src/geometry/quickhull2.d.ts +10 -0
- package/dist/src/geometry/quickhull3.d.ts +27 -0
- package/dist/src/ik/fabrik2.d.ts +314 -0
- package/dist/src/ik/fabrik3.d.ts +371 -0
- package/dist/src/ik/index.d.ts +2 -0
- package/dist/src/index.d.ts +1 -0
- package/dist/src/noise/fractal.d.ts +95 -0
- package/dist/src/noise/index.d.ts +9 -0
- package/dist/src/noise/perlin2d.d.ts +19 -0
- package/dist/src/noise/perlin3d.d.ts +20 -0
- package/dist/src/noise/permutation.d.ts +22 -0
- package/dist/src/noise/simplex2d.d.ts +19 -0
- package/dist/src/noise/simplex3d.d.ts +20 -0
- package/dist/src/noise/simplex4d.d.ts +24 -0
- package/dist/src/noise/worley2d.d.ts +22 -0
- package/dist/src/noise/worley3d.d.ts +23 -0
- package/dist/src/random/index.d.ts +8 -0
- package/dist/src/random/isaac32.d.ts +62 -0
- package/dist/src/random/isaac64.d.ts +75 -0
- package/dist/src/random/mulberry32.d.ts +43 -0
- package/dist/src/random/random.d.ts +67 -0
- package/dist/src/shapes/box2.d.ts +174 -0
- package/dist/src/shapes/box3.d.ts +213 -0
- package/dist/src/shapes/circle.d.ts +7 -0
- package/dist/src/shapes/frustum.d.ts +147 -0
- package/dist/src/shapes/index.d.ts +20 -0
- package/dist/src/shapes/obb3.d.ts +105 -0
- package/dist/src/shapes/plane3.d.ts +130 -0
- package/dist/src/shapes/polygon2.d.ts +155 -0
- package/dist/src/shapes/raycast3.d.ts +42 -0
- package/dist/src/shapes/segment2.d.ts +34 -0
- package/dist/src/shapes/sphere.d.ts +19 -0
- package/dist/src/shapes/triangle2.d.ts +53 -0
- package/dist/src/shapes/triangle3.d.ts +29 -0
- package/dist/src/time/easing.d.ts +21 -0
- package/dist/src/time/index.d.ts +6 -0
- package/dist/src/time/spring-core.d.ts +15 -0
- package/dist/src/time/spring.d.ts +36 -0
- package/dist/src/time/spring2.d.ts +11 -0
- package/dist/src/time/spring3.d.ts +11 -0
- package/dist/src/time/spring4.d.ts +11 -0
- package/dist/time/easing.js +24 -0
- package/dist/time/easing.js.map +1 -0
- package/dist/time/index.js +11 -0
- package/dist/time/index.js.map +1 -0
- package/dist/time/spring-core.js +48 -0
- package/dist/time/spring-core.js.map +1 -0
- package/dist/time/spring.js +62 -0
- package/dist/time/spring.js.map +1 -0
- package/dist/time/spring2.js +31 -0
- package/dist/time/spring2.js.map +1 -0
- package/dist/time/spring3.js +32 -0
- package/dist/time/spring3.js.map +1 -0
- package/dist/time/spring4.js +32 -0
- package/dist/time/spring4.js.map +1 -0
- package/package.json +90 -16
- package/skills/math/SKILL.md +140 -0
- package/AUTHORS +0 -1
- package/Cakefile +0 -28
- package/math.coffee +0 -112
- package/math.js +0 -141
|
@@ -0,0 +1,550 @@
|
|
|
1
|
+
import { EPSILON } from '../core/scalar.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Create a new empty Box3 with "min" set to positive infinity and "max" set to negative infinity
|
|
5
|
+
* @returns A new Box3
|
|
6
|
+
*/
|
|
7
|
+
function create() {
|
|
8
|
+
return [
|
|
9
|
+
Number.POSITIVE_INFINITY,
|
|
10
|
+
Number.POSITIVE_INFINITY,
|
|
11
|
+
Number.POSITIVE_INFINITY,
|
|
12
|
+
Number.NEGATIVE_INFINITY,
|
|
13
|
+
Number.NEGATIVE_INFINITY,
|
|
14
|
+
Number.NEGATIVE_INFINITY,
|
|
15
|
+
];
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Clones a Box3
|
|
19
|
+
* @param box - A Box3 to clone
|
|
20
|
+
* @returns a clone of box
|
|
21
|
+
*/
|
|
22
|
+
function clone(box) {
|
|
23
|
+
return [box[0], box[1], box[2], box[3], box[4], box[5]];
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Copies a Box3 to another Box3
|
|
27
|
+
* @param out the output Box3
|
|
28
|
+
* @param box the input Box3
|
|
29
|
+
* @returns the output Box3
|
|
30
|
+
*/
|
|
31
|
+
function copy(out, box) {
|
|
32
|
+
out[0] = box[0];
|
|
33
|
+
out[1] = box[1];
|
|
34
|
+
out[2] = box[2];
|
|
35
|
+
out[3] = box[3];
|
|
36
|
+
out[4] = box[4];
|
|
37
|
+
out[5] = box[5];
|
|
38
|
+
return out;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Sets the min and max values of a Box3
|
|
42
|
+
* @param out - The output Box3
|
|
43
|
+
* @param minX - The minimum X coordinate
|
|
44
|
+
* @param minY - The minimum Y coordinate
|
|
45
|
+
* @param minZ - The minimum Z coordinate
|
|
46
|
+
* @param maxX - The maximum X coordinate
|
|
47
|
+
* @param maxY - The maximum Y coordinate
|
|
48
|
+
* @param maxZ - The maximum Z coordinate
|
|
49
|
+
* @returns The updated Box3
|
|
50
|
+
*/
|
|
51
|
+
function set(out, minX, minY, minZ, maxX, maxY, maxZ) {
|
|
52
|
+
out[0] = minX;
|
|
53
|
+
out[1] = minY;
|
|
54
|
+
out[2] = minZ;
|
|
55
|
+
out[3] = maxX;
|
|
56
|
+
out[4] = maxY;
|
|
57
|
+
out[5] = maxZ;
|
|
58
|
+
return out;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Sets the min and max values of a Box3 from Vec3 vectors
|
|
62
|
+
* @param out - The output Box3
|
|
63
|
+
* @param min - The minimum corner
|
|
64
|
+
* @param max - The maximum corner
|
|
65
|
+
* @returns The updated Box3
|
|
66
|
+
*/
|
|
67
|
+
function setFromVectors(out, min, max) {
|
|
68
|
+
out[0] = min[0];
|
|
69
|
+
out[1] = min[1];
|
|
70
|
+
out[2] = min[2];
|
|
71
|
+
out[3] = max[0];
|
|
72
|
+
out[4] = max[1];
|
|
73
|
+
out[5] = max[2];
|
|
74
|
+
return out;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Extracts the minimum corner of a Box3
|
|
78
|
+
* @param out - The output Vec3 for the minimum corner
|
|
79
|
+
* @param box - The input Box3
|
|
80
|
+
* @returns The minimum corner
|
|
81
|
+
*/
|
|
82
|
+
function min(out, box) {
|
|
83
|
+
out[0] = box[0];
|
|
84
|
+
out[1] = box[1];
|
|
85
|
+
out[2] = box[2];
|
|
86
|
+
return out;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Extracts the maximum corner of a Box3
|
|
90
|
+
* @param out - The output Vec3 for the maximum corner
|
|
91
|
+
* @param box - The input Box3
|
|
92
|
+
* @returns The maximum corner
|
|
93
|
+
*/
|
|
94
|
+
function max(out, box) {
|
|
95
|
+
out[0] = box[3];
|
|
96
|
+
out[1] = box[4];
|
|
97
|
+
out[2] = box[5];
|
|
98
|
+
return out;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Set a Box3 to empty (min to positive infinity, max to negative infinity)
|
|
102
|
+
* @param out - The Box3 to make empty
|
|
103
|
+
* @returns The emptied Box3
|
|
104
|
+
*/
|
|
105
|
+
function empty(out) {
|
|
106
|
+
out[0] = Number.POSITIVE_INFINITY;
|
|
107
|
+
out[1] = Number.POSITIVE_INFINITY;
|
|
108
|
+
out[2] = Number.POSITIVE_INFINITY;
|
|
109
|
+
out[3] = Number.NEGATIVE_INFINITY;
|
|
110
|
+
out[4] = Number.NEGATIVE_INFINITY;
|
|
111
|
+
out[5] = Number.NEGATIVE_INFINITY;
|
|
112
|
+
return out;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Returns whether or not the boxes have exactly the same elements in the same position (when compared with ===)
|
|
116
|
+
* @param a - The first box
|
|
117
|
+
* @param b - The second box
|
|
118
|
+
* @returns True if the boxes are equal, false otherwise
|
|
119
|
+
*/
|
|
120
|
+
function exactEquals(a, b) {
|
|
121
|
+
return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3] && a[4] === b[4] && a[5] === b[5];
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Returns whether or not the boxes have approximately the same elements in the same position
|
|
125
|
+
* @param a - The first box
|
|
126
|
+
* @param b - The second box
|
|
127
|
+
* @returns True if the boxes are equal, false otherwise
|
|
128
|
+
*/
|
|
129
|
+
function equals(a, b) {
|
|
130
|
+
const a0 = a[0];
|
|
131
|
+
const a1 = a[1];
|
|
132
|
+
const a2 = a[2];
|
|
133
|
+
const a3 = a[3];
|
|
134
|
+
const a4 = a[4];
|
|
135
|
+
const a5 = a[5];
|
|
136
|
+
const b0 = b[0];
|
|
137
|
+
const b1 = b[1];
|
|
138
|
+
const b2 = b[2];
|
|
139
|
+
const b3 = b[3];
|
|
140
|
+
const b4 = b[4];
|
|
141
|
+
const b5 = b[5];
|
|
142
|
+
return (Math.abs(a0 - b0) <= EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) &&
|
|
143
|
+
Math.abs(a1 - b1) <= EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) &&
|
|
144
|
+
Math.abs(a2 - b2) <= EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2)) &&
|
|
145
|
+
Math.abs(a3 - b3) <= EPSILON * Math.max(1.0, Math.abs(a3), Math.abs(b3)) &&
|
|
146
|
+
Math.abs(a4 - b4) <= EPSILON * Math.max(1.0, Math.abs(a4), Math.abs(b4)) &&
|
|
147
|
+
Math.abs(a5 - b5) <= EPSILON * Math.max(1.0, Math.abs(a5), Math.abs(b5)));
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Sets the box from a center point and size
|
|
151
|
+
* @param out - The output Box3
|
|
152
|
+
* @param center - The center point
|
|
153
|
+
* @param size - The size of the box
|
|
154
|
+
* @returns The updated Box3
|
|
155
|
+
*/
|
|
156
|
+
function setFromCenterAndSize(out, center, size) {
|
|
157
|
+
const hx = size[0] * 0.5;
|
|
158
|
+
const hy = size[1] * 0.5;
|
|
159
|
+
const hz = size[2] * 0.5;
|
|
160
|
+
out[0] = center[0] - hx;
|
|
161
|
+
out[1] = center[1] - hy;
|
|
162
|
+
out[2] = center[2] - hz;
|
|
163
|
+
out[3] = center[0] + hx;
|
|
164
|
+
out[4] = center[1] + hy;
|
|
165
|
+
out[5] = center[2] + hz;
|
|
166
|
+
return out;
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Expands a Box3 to include a point
|
|
170
|
+
* @param out - The output Box3
|
|
171
|
+
* @param box - The input Box3
|
|
172
|
+
* @param point - The point to include
|
|
173
|
+
* @returns The expanded Box3
|
|
174
|
+
*/
|
|
175
|
+
function expandByPoint(out, box, point) {
|
|
176
|
+
out[0] = Math.min(box[0], point[0]);
|
|
177
|
+
out[1] = Math.min(box[1], point[1]);
|
|
178
|
+
out[2] = Math.min(box[2], point[2]);
|
|
179
|
+
out[3] = Math.max(box[3], point[0]);
|
|
180
|
+
out[4] = Math.max(box[4], point[1]);
|
|
181
|
+
out[5] = Math.max(box[5], point[2]);
|
|
182
|
+
return out;
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Widens a Box3 by a vector on both sides
|
|
186
|
+
* Subtracts the vector from min and adds it to max
|
|
187
|
+
* @param out - The output Box3
|
|
188
|
+
* @param box - The input Box3
|
|
189
|
+
* @param vector - The vector to expand by
|
|
190
|
+
* @returns The expanded Box3
|
|
191
|
+
*/
|
|
192
|
+
function expandByExtents(out, box, vector) {
|
|
193
|
+
out[0] = box[0] - vector[0];
|
|
194
|
+
out[1] = box[1] - vector[1];
|
|
195
|
+
out[2] = box[2] - vector[2];
|
|
196
|
+
out[3] = box[3] + vector[0];
|
|
197
|
+
out[4] = box[4] + vector[1];
|
|
198
|
+
out[5] = box[5] + vector[2];
|
|
199
|
+
return out;
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Expands a Box3 uniformly by a scalar margin on all sides
|
|
203
|
+
* Subtracts the margin from min and adds it to max on each axis
|
|
204
|
+
* @param out - The output Box3
|
|
205
|
+
* @param box - The input Box3
|
|
206
|
+
* @param margin - The uniform margin to expand by
|
|
207
|
+
* @returns The expanded Box3
|
|
208
|
+
*/
|
|
209
|
+
function expandByMargin(out, box, margin) {
|
|
210
|
+
out[0] = box[0] - margin;
|
|
211
|
+
out[1] = box[1] - margin;
|
|
212
|
+
out[2] = box[2] - margin;
|
|
213
|
+
out[3] = box[3] + margin;
|
|
214
|
+
out[4] = box[4] + margin;
|
|
215
|
+
out[5] = box[5] + margin;
|
|
216
|
+
return out;
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* Computes the union of two bounding boxes
|
|
220
|
+
* Returns a Box3 that encompasses both input boxes
|
|
221
|
+
* @param out - The output Box3
|
|
222
|
+
* @param boxA - The first Box3
|
|
223
|
+
* @param boxB - The second Box3
|
|
224
|
+
* @returns The union Box3
|
|
225
|
+
*/
|
|
226
|
+
function union(out, boxA, boxB) {
|
|
227
|
+
out[0] = Math.min(boxA[0], boxB[0]);
|
|
228
|
+
out[1] = Math.min(boxA[1], boxB[1]);
|
|
229
|
+
out[2] = Math.min(boxA[2], boxB[2]);
|
|
230
|
+
out[3] = Math.max(boxA[3], boxB[3]);
|
|
231
|
+
out[4] = Math.max(boxA[4], boxB[4]);
|
|
232
|
+
out[5] = Math.max(boxA[5], boxB[5]);
|
|
233
|
+
return out;
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* Calculate the center point of a bounding box
|
|
237
|
+
* @param out - The output Vec3 for the center
|
|
238
|
+
* @param box - The input Box3
|
|
239
|
+
* @returns The center point
|
|
240
|
+
*/
|
|
241
|
+
function center(out, box) {
|
|
242
|
+
out[0] = (box[0] + box[3]) * 0.5;
|
|
243
|
+
out[1] = (box[1] + box[4]) * 0.5;
|
|
244
|
+
out[2] = (box[2] + box[5]) * 0.5;
|
|
245
|
+
return out;
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* Calculate the extents (half-size) of a bounding box
|
|
249
|
+
* @param out - The output Vec3 for the extents
|
|
250
|
+
* @param box - The input Box3
|
|
251
|
+
* @returns The extents (distance from center to each face)
|
|
252
|
+
*/
|
|
253
|
+
function extents(out, box) {
|
|
254
|
+
out[0] = (box[3] - box[0]) * 0.5;
|
|
255
|
+
out[1] = (box[4] - box[1]) * 0.5;
|
|
256
|
+
out[2] = (box[5] - box[2]) * 0.5;
|
|
257
|
+
return out;
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* Calculate the size (dimensions) of a bounding box
|
|
261
|
+
* @param out - The output Vec3 for the size
|
|
262
|
+
* @param box - The input Box3
|
|
263
|
+
* @returns The size (width, height, depth)
|
|
264
|
+
*/
|
|
265
|
+
function size(out, box) {
|
|
266
|
+
out[0] = box[3] - box[0];
|
|
267
|
+
out[1] = box[4] - box[1];
|
|
268
|
+
out[2] = box[5] - box[2];
|
|
269
|
+
return out;
|
|
270
|
+
}
|
|
271
|
+
/**
|
|
272
|
+
* Calculate the surface area of a bounding box
|
|
273
|
+
* @param box - The input Box3
|
|
274
|
+
* @returns The surface area
|
|
275
|
+
*/
|
|
276
|
+
function surfaceArea(box) {
|
|
277
|
+
const width = box[3] - box[0];
|
|
278
|
+
const height = box[4] - box[1];
|
|
279
|
+
const depth = box[5] - box[2];
|
|
280
|
+
return 2 * (width * height + width * depth + height * depth);
|
|
281
|
+
}
|
|
282
|
+
/**
|
|
283
|
+
* Scale a bounding box by a vector, handling non-uniform and negative scaling
|
|
284
|
+
* @param out - The output Box3
|
|
285
|
+
* @param box - The input Box3
|
|
286
|
+
* @param scale - The scale to apply (as a Vec3)
|
|
287
|
+
* @returns The scaled Box3
|
|
288
|
+
*/
|
|
289
|
+
function scale(out, box, scale) {
|
|
290
|
+
const minX = box[0] * scale[0];
|
|
291
|
+
const maxX = box[3] * scale[0];
|
|
292
|
+
const minY = box[1] * scale[1];
|
|
293
|
+
const maxY = box[4] * scale[1];
|
|
294
|
+
const minZ = box[2] * scale[2];
|
|
295
|
+
const maxZ = box[5] * scale[2];
|
|
296
|
+
// handle negative scaling by ensuring min <= max for each axis
|
|
297
|
+
out[0] = Math.min(minX, maxX);
|
|
298
|
+
out[3] = Math.max(minX, maxX);
|
|
299
|
+
out[1] = Math.min(minY, maxY);
|
|
300
|
+
out[4] = Math.max(minY, maxY);
|
|
301
|
+
out[2] = Math.min(minZ, maxZ);
|
|
302
|
+
out[5] = Math.max(minZ, maxZ);
|
|
303
|
+
return out;
|
|
304
|
+
}
|
|
305
|
+
/**
|
|
306
|
+
* Transform a bounding box by a 4x4 matrix.
|
|
307
|
+
* Uses Arvo's trick — transform the center, build new half-extents from
|
|
308
|
+
* |M| · extents — which is ~4× fewer ops than transforming all 8 corners.
|
|
309
|
+
* Reference: Jim Arvo, "Transforming Axis-Aligned Bounding Boxes",
|
|
310
|
+
* Graphics Gems I (1990).
|
|
311
|
+
* https://github.com/erich666/GraphicsGems/blob/master/gems/TransBox.c
|
|
312
|
+
* Assumes mat is affine (no perspective), which is always true for AABB
|
|
313
|
+
* transforms in practice.
|
|
314
|
+
* Safe under aliasing (out and box may be the same array): all six box
|
|
315
|
+
* components are read into locals before out is written.
|
|
316
|
+
* @param out - The output Box3
|
|
317
|
+
* @param box - The input Box3
|
|
318
|
+
* @param mat - The 4x4 transformation matrix
|
|
319
|
+
* @returns The transformed Box3
|
|
320
|
+
*/
|
|
321
|
+
function transformMat4(out, box, mat) {
|
|
322
|
+
const bMinX = box[0];
|
|
323
|
+
const bMinY = box[1];
|
|
324
|
+
const bMinZ = box[2];
|
|
325
|
+
const bMaxX = box[3];
|
|
326
|
+
const bMaxY = box[4];
|
|
327
|
+
const bMaxZ = box[5];
|
|
328
|
+
// empty input → empty output (preserve sentinel rather than producing
|
|
329
|
+
// a bogus transformed box from negative extents)
|
|
330
|
+
if (bMinX > bMaxX || bMinY > bMaxY || bMinZ > bMaxZ) {
|
|
331
|
+
out[0] = Number.POSITIVE_INFINITY;
|
|
332
|
+
out[1] = Number.POSITIVE_INFINITY;
|
|
333
|
+
out[2] = Number.POSITIVE_INFINITY;
|
|
334
|
+
out[3] = Number.NEGATIVE_INFINITY;
|
|
335
|
+
out[4] = Number.NEGATIVE_INFINITY;
|
|
336
|
+
out[5] = Number.NEGATIVE_INFINITY;
|
|
337
|
+
return out;
|
|
338
|
+
}
|
|
339
|
+
const cx = (bMinX + bMaxX) * 0.5;
|
|
340
|
+
const cy = (bMinY + bMaxY) * 0.5;
|
|
341
|
+
const cz = (bMinZ + bMaxZ) * 0.5;
|
|
342
|
+
const ex = (bMaxX - bMinX) * 0.5;
|
|
343
|
+
const ey = (bMaxY - bMinY) * 0.5;
|
|
344
|
+
const ez = (bMaxZ - bMinZ) * 0.5;
|
|
345
|
+
const m0 = mat[0], m1 = mat[1], m2 = mat[2];
|
|
346
|
+
const m4 = mat[4], m5 = mat[5], m6 = mat[6];
|
|
347
|
+
const m8 = mat[8], m9 = mat[9], m10 = mat[10];
|
|
348
|
+
const tcx = m0 * cx + m4 * cy + m8 * cz + mat[12];
|
|
349
|
+
const tcy = m1 * cx + m5 * cy + m9 * cz + mat[13];
|
|
350
|
+
const tcz = m2 * cx + m6 * cy + m10 * cz + mat[14];
|
|
351
|
+
const tex = Math.abs(m0) * ex + Math.abs(m4) * ey + Math.abs(m8) * ez;
|
|
352
|
+
const tey = Math.abs(m1) * ex + Math.abs(m5) * ey + Math.abs(m9) * ez;
|
|
353
|
+
const tez = Math.abs(m2) * ex + Math.abs(m6) * ey + Math.abs(m10) * ez;
|
|
354
|
+
out[0] = tcx - tex;
|
|
355
|
+
out[1] = tcy - tey;
|
|
356
|
+
out[2] = tcz - tez;
|
|
357
|
+
out[3] = tcx + tex;
|
|
358
|
+
out[4] = tcy + tey;
|
|
359
|
+
out[5] = tcz + tez;
|
|
360
|
+
return out;
|
|
361
|
+
}
|
|
362
|
+
/**
|
|
363
|
+
* Test if a point is contained within the bounding box
|
|
364
|
+
* @param box - The bounding box
|
|
365
|
+
* @param point - The point to test
|
|
366
|
+
* @returns true if the point is inside or on the boundary of the box
|
|
367
|
+
*/
|
|
368
|
+
function containsPoint(box, point) {
|
|
369
|
+
return (point[0] >= box[0] &&
|
|
370
|
+
point[0] <= box[3] &&
|
|
371
|
+
point[1] >= box[1] &&
|
|
372
|
+
point[1] <= box[4] &&
|
|
373
|
+
point[2] >= box[2] &&
|
|
374
|
+
point[2] <= box[5]);
|
|
375
|
+
}
|
|
376
|
+
/**
|
|
377
|
+
* Test if one Box3 completely contains another Box3
|
|
378
|
+
* @param container - The potentially containing Box3
|
|
379
|
+
* @param contained - The Box3 that might be contained
|
|
380
|
+
* @returns true if the container Box3 completely contains the contained Box3
|
|
381
|
+
*/
|
|
382
|
+
function containsBox3(container, contained) {
|
|
383
|
+
return (contained[0] >= container[0] &&
|
|
384
|
+
contained[3] <= container[3] &&
|
|
385
|
+
contained[1] >= container[1] &&
|
|
386
|
+
contained[4] <= container[4] &&
|
|
387
|
+
contained[2] >= container[2] &&
|
|
388
|
+
contained[5] <= container[5]);
|
|
389
|
+
}
|
|
390
|
+
/**
|
|
391
|
+
* Check whether two bounding boxes intersect
|
|
392
|
+
*/
|
|
393
|
+
function intersectsBox3(boxA, boxB) {
|
|
394
|
+
return (boxA[0] <= boxB[3] &&
|
|
395
|
+
boxA[3] >= boxB[0] &&
|
|
396
|
+
boxA[1] <= boxB[4] &&
|
|
397
|
+
boxA[4] >= boxB[1] &&
|
|
398
|
+
boxA[2] <= boxB[5] &&
|
|
399
|
+
boxA[5] >= boxB[2]);
|
|
400
|
+
}
|
|
401
|
+
/**
|
|
402
|
+
* Test whether an axis-aligned bounding box intersects a triangle, via the
|
|
403
|
+
* separating-axis theorem over 13 axes: the 3 box face normals, the triangle
|
|
404
|
+
* face normal, and the 9 box-axis × triangle-edge cross products.
|
|
405
|
+
*
|
|
406
|
+
* Fully inlined with local scalars — no scratch arrays or per-call allocations.
|
|
407
|
+
* Axes are tested cheapest-first (box faces, i.e. the triangle-vs-box AABB
|
|
408
|
+
* reject) so the common non-overlapping case exits before any edge or cross
|
|
409
|
+
* product is computed. On each edge-cross axis two of the three vertices project
|
|
410
|
+
* to the same value (the axis is perpendicular to that edge), so only two
|
|
411
|
+
* projections are needed. An all-zero cross axis (edge parallel to a box axis)
|
|
412
|
+
* collapses every projection and the radius to 0, passing automatically.
|
|
413
|
+
*/
|
|
414
|
+
function intersectsTriangle3(box, a, b, c) {
|
|
415
|
+
// Empty box quick reject
|
|
416
|
+
if (box[0] > box[3] || box[1] > box[4] || box[2] > box[5])
|
|
417
|
+
return false;
|
|
418
|
+
// Box center and half-extents
|
|
419
|
+
const cx = (box[0] + box[3]) * 0.5;
|
|
420
|
+
const cy = (box[1] + box[4]) * 0.5;
|
|
421
|
+
const cz = (box[2] + box[5]) * 0.5;
|
|
422
|
+
const ex = box[3] - cx;
|
|
423
|
+
const ey = box[4] - cy;
|
|
424
|
+
const ez = box[5] - cz;
|
|
425
|
+
// Triangle vertices relative to the box center
|
|
426
|
+
const v0x = a[0] - cx;
|
|
427
|
+
const v0y = a[1] - cy;
|
|
428
|
+
const v0z = a[2] - cz;
|
|
429
|
+
const v1x = b[0] - cx;
|
|
430
|
+
const v1y = b[1] - cy;
|
|
431
|
+
const v1z = b[2] - cz;
|
|
432
|
+
const v2x = c[0] - cx;
|
|
433
|
+
const v2y = c[1] - cy;
|
|
434
|
+
const v2z = c[2] - cz;
|
|
435
|
+
// 3 box face normals first: this is the triangle-AABB vs box reject and
|
|
436
|
+
// knocks out most non-overlapping pairs before any further work.
|
|
437
|
+
if (Math.min(v0x, v1x, v2x) > ex || Math.max(v0x, v1x, v2x) < -ex)
|
|
438
|
+
return false;
|
|
439
|
+
if (Math.min(v0y, v1y, v2y) > ey || Math.max(v0y, v1y, v2y) < -ey)
|
|
440
|
+
return false;
|
|
441
|
+
if (Math.min(v0z, v1z, v2z) > ez || Math.max(v0z, v1z, v2z) < -ez)
|
|
442
|
+
return false;
|
|
443
|
+
// Triangle edge vectors
|
|
444
|
+
const f0x = v1x - v0x;
|
|
445
|
+
const f0y = v1y - v0y;
|
|
446
|
+
const f0z = v1z - v0z;
|
|
447
|
+
const f1x = v2x - v1x;
|
|
448
|
+
const f1y = v2y - v1y;
|
|
449
|
+
const f1z = v2z - v1z;
|
|
450
|
+
const f2x = v0x - v2x;
|
|
451
|
+
const f2y = v0y - v2y;
|
|
452
|
+
const f2z = v0z - v2z;
|
|
453
|
+
let pa;
|
|
454
|
+
let pb;
|
|
455
|
+
let r;
|
|
456
|
+
// Triangle face normal (all three vertices share one projection)
|
|
457
|
+
const nx = f0y * f1z - f0z * f1y;
|
|
458
|
+
const ny = f0z * f1x - f0x * f1z;
|
|
459
|
+
const nz = f0x * f1y - f0y * f1x;
|
|
460
|
+
const d = v0x * nx + v0y * ny + v0z * nz;
|
|
461
|
+
r = ex * Math.abs(nx) + ey * Math.abs(ny) + ez * Math.abs(nz);
|
|
462
|
+
if (d > r || d < -r)
|
|
463
|
+
return false;
|
|
464
|
+
// 9 axes: box axis × triangle edge. The axis is perpendicular to its edge,
|
|
465
|
+
// so the two vertices on that edge project equally — only two projections
|
|
466
|
+
// (pa, pb) differ.
|
|
467
|
+
// box X (1,0,0) × edge => (0, -fz, fy)
|
|
468
|
+
pa = v0z * f0y - v0y * f0z;
|
|
469
|
+
pb = v2z * f0y - v2y * f0z;
|
|
470
|
+
r = ey * Math.abs(f0z) + ez * Math.abs(f0y);
|
|
471
|
+
if (Math.min(pa, pb) > r || Math.max(pa, pb) < -r)
|
|
472
|
+
return false;
|
|
473
|
+
pa = v0z * f1y - v0y * f1z;
|
|
474
|
+
pb = v1z * f1y - v1y * f1z;
|
|
475
|
+
r = ey * Math.abs(f1z) + ez * Math.abs(f1y);
|
|
476
|
+
if (Math.min(pa, pb) > r || Math.max(pa, pb) < -r)
|
|
477
|
+
return false;
|
|
478
|
+
pa = v0z * f2y - v0y * f2z;
|
|
479
|
+
pb = v1z * f2y - v1y * f2z;
|
|
480
|
+
r = ey * Math.abs(f2z) + ez * Math.abs(f2y);
|
|
481
|
+
if (Math.min(pa, pb) > r || Math.max(pa, pb) < -r)
|
|
482
|
+
return false;
|
|
483
|
+
// box Y (0,1,0) × edge => (fz, 0, -fx)
|
|
484
|
+
pa = v0x * f0z - v0z * f0x;
|
|
485
|
+
pb = v2x * f0z - v2z * f0x;
|
|
486
|
+
r = ex * Math.abs(f0z) + ez * Math.abs(f0x);
|
|
487
|
+
if (Math.min(pa, pb) > r || Math.max(pa, pb) < -r)
|
|
488
|
+
return false;
|
|
489
|
+
pa = v0x * f1z - v0z * f1x;
|
|
490
|
+
pb = v1x * f1z - v1z * f1x;
|
|
491
|
+
r = ex * Math.abs(f1z) + ez * Math.abs(f1x);
|
|
492
|
+
if (Math.min(pa, pb) > r || Math.max(pa, pb) < -r)
|
|
493
|
+
return false;
|
|
494
|
+
pa = v0x * f2z - v0z * f2x;
|
|
495
|
+
pb = v1x * f2z - v1z * f2x;
|
|
496
|
+
r = ex * Math.abs(f2z) + ez * Math.abs(f2x);
|
|
497
|
+
if (Math.min(pa, pb) > r || Math.max(pa, pb) < -r)
|
|
498
|
+
return false;
|
|
499
|
+
// box Z (0,0,1) × edge => (-fy, fx, 0)
|
|
500
|
+
pa = v0y * f0x - v0x * f0y;
|
|
501
|
+
pb = v2y * f0x - v2x * f0y;
|
|
502
|
+
r = ex * Math.abs(f0y) + ey * Math.abs(f0x);
|
|
503
|
+
if (Math.min(pa, pb) > r || Math.max(pa, pb) < -r)
|
|
504
|
+
return false;
|
|
505
|
+
pa = v0y * f1x - v0x * f1y;
|
|
506
|
+
pb = v1y * f1x - v1x * f1y;
|
|
507
|
+
r = ex * Math.abs(f1y) + ey * Math.abs(f1x);
|
|
508
|
+
if (Math.min(pa, pb) > r || Math.max(pa, pb) < -r)
|
|
509
|
+
return false;
|
|
510
|
+
pa = v0y * f2x - v0x * f2y;
|
|
511
|
+
pb = v1y * f2x - v1x * f2y;
|
|
512
|
+
r = ex * Math.abs(f2y) + ey * Math.abs(f2x);
|
|
513
|
+
if (Math.min(pa, pb) > r || Math.max(pa, pb) < -r)
|
|
514
|
+
return false;
|
|
515
|
+
return true;
|
|
516
|
+
}
|
|
517
|
+
/**
|
|
518
|
+
* Test intersection between axis-aligned bounding box and a sphere.
|
|
519
|
+
*/
|
|
520
|
+
function intersectsSphere(box, sphere) {
|
|
521
|
+
const { center, radius } = sphere;
|
|
522
|
+
const cx = center[0];
|
|
523
|
+
const cy = center[1];
|
|
524
|
+
const cz = center[2];
|
|
525
|
+
// distance from the sphere centre to the box along each axis (0 when inside)
|
|
526
|
+
const dx = cx < box[0] ? box[0] - cx : cx > box[3] ? cx - box[3] : 0;
|
|
527
|
+
const dy = cy < box[1] ? box[1] - cy : cy > box[4] ? cy - box[4] : 0;
|
|
528
|
+
const dz = cz < box[2] ? box[2] - cz : cz > box[5] ? cz - box[5] : 0;
|
|
529
|
+
return dx * dx + dy * dy + dz * dz <= radius * radius;
|
|
530
|
+
}
|
|
531
|
+
/**
|
|
532
|
+
* Test intersection between axis-aligned bounding box and plane.
|
|
533
|
+
*/
|
|
534
|
+
function intersectsPlane3(box, plane) {
|
|
535
|
+
const { normal, constant } = plane;
|
|
536
|
+
const nx = normal[0];
|
|
537
|
+
const ny = normal[1];
|
|
538
|
+
const nz = normal[2];
|
|
539
|
+
// Signed distance from the box centre to the plane, and the box's projected
|
|
540
|
+
// half-extent (radius) onto the normal. Branchless equivalent of picking the
|
|
541
|
+
// near/far corners per axis: the box straddles the plane iff |s| <= r.
|
|
542
|
+
// Everything is kept at 2x scale (centre*2, extent*2) so the per-axis 0.5
|
|
543
|
+
// factors drop out; the |s| <= r test is unaffected.
|
|
544
|
+
const s = nx * (box[0] + box[3]) + ny * (box[1] + box[4]) + nz * (box[2] + box[5]) + 2 * constant;
|
|
545
|
+
const r = Math.abs(nx) * (box[3] - box[0]) + Math.abs(ny) * (box[4] - box[1]) + Math.abs(nz) * (box[5] - box[2]);
|
|
546
|
+
return s <= r && s >= -r;
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
export { center, clone, containsBox3, containsPoint, copy, create, empty, equals, exactEquals, expandByExtents, expandByMargin, expandByPoint, extents, intersectsBox3, intersectsPlane3, intersectsSphere, intersectsTriangle3, max, min, scale, set, setFromCenterAndSize, setFromVectors, size, surfaceArea, transformMat4, union };
|
|
550
|
+
//# sourceMappingURL=box3.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"box3.js","sources":["../../src/shapes/box3.ts"],"sourcesContent":["import { EPSILON } from '../core/scalar';\nimport type { Mat4 } from '../core/mat4';\nimport type { Vec3 } from '../core/vec3';\nimport type { Plane3 } from './plane3';\nimport type { Sphere } from './sphere';\n\n/** A box in 3D space */\nexport type Box3 = [minX: number, minY: number, minZ: number, maxX: number, maxY: number, maxZ: number];\n\n/**\n * Create a new empty Box3 with \"min\" set to positive infinity and \"max\" set to negative infinity\n * @returns A new Box3\n */\nexport function create(): Box3 {\n return [\n Number.POSITIVE_INFINITY,\n Number.POSITIVE_INFINITY,\n Number.POSITIVE_INFINITY,\n Number.NEGATIVE_INFINITY,\n Number.NEGATIVE_INFINITY,\n Number.NEGATIVE_INFINITY,\n ];\n}\n\n/**\n * Clones a Box3\n * @param box - A Box3 to clone\n * @returns a clone of box\n */\nexport function clone(box: Box3): Box3 {\n return [box[0], box[1], box[2], box[3], box[4], box[5]];\n}\n\n/**\n * Copies a Box3 to another Box3\n * @param out the output Box3\n * @param box the input Box3\n * @returns the output Box3\n */\nexport function copy(out: Box3, box: Box3): Box3 {\n out[0] = box[0];\n out[1] = box[1];\n out[2] = box[2];\n out[3] = box[3];\n out[4] = box[4];\n out[5] = box[5];\n return out;\n}\n\n/**\n * Sets the min and max values of a Box3\n * @param out - The output Box3\n * @param minX - The minimum X coordinate\n * @param minY - The minimum Y coordinate\n * @param minZ - The minimum Z coordinate\n * @param maxX - The maximum X coordinate\n * @param maxY - The maximum Y coordinate\n * @param maxZ - The maximum Z coordinate\n * @returns The updated Box3\n */\nexport function set(out: Box3, minX: number, minY: number, minZ: number, maxX: number, maxY: number, maxZ: number): Box3 {\n out[0] = minX;\n out[1] = minY;\n out[2] = minZ;\n out[3] = maxX;\n out[4] = maxY;\n out[5] = maxZ;\n return out;\n}\n\n/**\n * Sets the min and max values of a Box3 from Vec3 vectors\n * @param out - The output Box3\n * @param min - The minimum corner\n * @param max - The maximum corner\n * @returns The updated Box3\n */\nexport function setFromVectors(out: Box3, min: Vec3, max: Vec3): Box3 {\n out[0] = min[0];\n out[1] = min[1];\n out[2] = min[2];\n out[3] = max[0];\n out[4] = max[1];\n out[5] = max[2];\n return out;\n}\n\n/**\n * Extracts the minimum corner of a Box3\n * @param out - The output Vec3 for the minimum corner\n * @param box - The input Box3\n * @returns The minimum corner\n */\nexport function min(out: Vec3, box: Box3): Vec3 {\n out[0] = box[0];\n out[1] = box[1];\n out[2] = box[2];\n return out;\n}\n\n/**\n * Extracts the maximum corner of a Box3\n * @param out - The output Vec3 for the maximum corner\n * @param box - The input Box3\n * @returns The maximum corner\n */\nexport function max(out: Vec3, box: Box3): Vec3 {\n out[0] = box[3];\n out[1] = box[4];\n out[2] = box[5];\n return out;\n}\n\n/**\n * Set a Box3 to empty (min to positive infinity, max to negative infinity)\n * @param out - The Box3 to make empty\n * @returns The emptied Box3\n */\nexport function empty(out: Box3): Box3 {\n out[0] = Number.POSITIVE_INFINITY;\n out[1] = Number.POSITIVE_INFINITY;\n out[2] = Number.POSITIVE_INFINITY;\n out[3] = Number.NEGATIVE_INFINITY;\n out[4] = Number.NEGATIVE_INFINITY;\n out[5] = Number.NEGATIVE_INFINITY;\n return out;\n}\n\n/**\n * Returns whether or not the boxes have exactly the same elements in the same position (when compared with ===)\n * @param a - The first box\n * @param b - The second box\n * @returns True if the boxes are equal, false otherwise\n */\nexport function exactEquals(a: Box3, b: Box3): boolean {\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3] && a[4] === b[4] && a[5] === b[5];\n}\n\n/**\n * Returns whether or not the boxes have approximately the same elements in the same position\n * @param a - The first box\n * @param b - The second box\n * @returns True if the boxes are equal, false otherwise\n */\nexport function equals(a: Box3, b: Box3): boolean {\n const a0 = a[0];\n const a1 = a[1];\n const a2 = a[2];\n const a3 = a[3];\n const a4 = a[4];\n const a5 = a[5];\n const b0 = b[0];\n const b1 = b[1];\n const b2 = b[2];\n const b3 = b[3];\n const b4 = b[4];\n const b5 = b[5];\n return (\n Math.abs(a0 - b0) <= EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) &&\n Math.abs(a1 - b1) <= EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) &&\n Math.abs(a2 - b2) <= EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2)) &&\n Math.abs(a3 - b3) <= EPSILON * Math.max(1.0, Math.abs(a3), Math.abs(b3)) &&\n Math.abs(a4 - b4) <= EPSILON * Math.max(1.0, Math.abs(a4), Math.abs(b4)) &&\n Math.abs(a5 - b5) <= EPSILON * Math.max(1.0, Math.abs(a5), Math.abs(b5))\n );\n}\n\n/**\n * Sets the box from a center point and size\n * @param out - The output Box3\n * @param center - The center point\n * @param size - The size of the box\n * @returns The updated Box3\n */\nexport function setFromCenterAndSize(out: Box3, center: Vec3, size: Vec3): Box3 {\n const hx = size[0] * 0.5;\n const hy = size[1] * 0.5;\n const hz = size[2] * 0.5;\n out[0] = center[0] - hx;\n out[1] = center[1] - hy;\n out[2] = center[2] - hz;\n out[3] = center[0] + hx;\n out[4] = center[1] + hy;\n out[5] = center[2] + hz;\n return out;\n}\n\n/**\n * Expands a Box3 to include a point\n * @param out - The output Box3\n * @param box - The input Box3\n * @param point - The point to include\n * @returns The expanded Box3\n */\nexport function expandByPoint(out: Box3, box: Box3, point: Vec3): Box3 {\n out[0] = Math.min(box[0], point[0]);\n out[1] = Math.min(box[1], point[1]);\n out[2] = Math.min(box[2], point[2]);\n out[3] = Math.max(box[3], point[0]);\n out[4] = Math.max(box[4], point[1]);\n out[5] = Math.max(box[5], point[2]);\n return out;\n}\n\n/**\n * Widens a Box3 by a vector on both sides\n * Subtracts the vector from min and adds it to max\n * @param out - The output Box3\n * @param box - The input Box3\n * @param vector - The vector to expand by\n * @returns The expanded Box3\n */\nexport function expandByExtents(out: Box3, box: Box3, vector: Vec3): Box3 {\n out[0] = box[0] - vector[0];\n out[1] = box[1] - vector[1];\n out[2] = box[2] - vector[2];\n out[3] = box[3] + vector[0];\n out[4] = box[4] + vector[1];\n out[5] = box[5] + vector[2];\n return out;\n}\n\n/**\n * Expands a Box3 uniformly by a scalar margin on all sides\n * Subtracts the margin from min and adds it to max on each axis\n * @param out - The output Box3\n * @param box - The input Box3\n * @param margin - The uniform margin to expand by\n * @returns The expanded Box3\n */\nexport function expandByMargin(out: Box3, box: Box3, margin: number): Box3 {\n out[0] = box[0] - margin;\n out[1] = box[1] - margin;\n out[2] = box[2] - margin;\n out[3] = box[3] + margin;\n out[4] = box[4] + margin;\n out[5] = box[5] + margin;\n return out;\n}\n\n/**\n * Computes the union of two bounding boxes\n * Returns a Box3 that encompasses both input boxes\n * @param out - The output Box3\n * @param boxA - The first Box3\n * @param boxB - The second Box3\n * @returns The union Box3\n */\nexport function union(out: Box3, boxA: Box3, boxB: Box3): Box3 {\n out[0] = Math.min(boxA[0], boxB[0]);\n out[1] = Math.min(boxA[1], boxB[1]);\n out[2] = Math.min(boxA[2], boxB[2]);\n out[3] = Math.max(boxA[3], boxB[3]);\n out[4] = Math.max(boxA[4], boxB[4]);\n out[5] = Math.max(boxA[5], boxB[5]);\n return out;\n}\n\n/**\n * Calculate the center point of a bounding box\n * @param out - The output Vec3 for the center\n * @param box - The input Box3\n * @returns The center point\n */\nexport function center(out: Vec3, box: Box3): Vec3 {\n out[0] = (box[0] + box[3]) * 0.5;\n out[1] = (box[1] + box[4]) * 0.5;\n out[2] = (box[2] + box[5]) * 0.5;\n return out;\n}\n\n/**\n * Calculate the extents (half-size) of a bounding box\n * @param out - The output Vec3 for the extents\n * @param box - The input Box3\n * @returns The extents (distance from center to each face)\n */\nexport function extents(out: Vec3, box: Box3): Vec3 {\n out[0] = (box[3] - box[0]) * 0.5;\n out[1] = (box[4] - box[1]) * 0.5;\n out[2] = (box[5] - box[2]) * 0.5;\n return out;\n}\n\n/**\n * Calculate the size (dimensions) of a bounding box\n * @param out - The output Vec3 for the size\n * @param box - The input Box3\n * @returns The size (width, height, depth)\n */\nexport function size(out: Vec3, box: Box3): Vec3 {\n out[0] = box[3] - box[0];\n out[1] = box[4] - box[1];\n out[2] = box[5] - box[2];\n return out;\n}\n\n/**\n * Calculate the surface area of a bounding box\n * @param box - The input Box3\n * @returns The surface area\n */\nexport function surfaceArea(box: Box3): number {\n const width = box[3] - box[0];\n const height = box[4] - box[1];\n const depth = box[5] - box[2];\n return 2 * (width * height + width * depth + height * depth);\n}\n\n/**\n * Scale a bounding box by a vector, handling non-uniform and negative scaling\n * @param out - The output Box3\n * @param box - The input Box3\n * @param scale - The scale to apply (as a Vec3)\n * @returns The scaled Box3\n */\nexport function scale(out: Box3, box: Box3, scale: Vec3): Box3 {\n const minX = box[0] * scale[0];\n const maxX = box[3] * scale[0];\n const minY = box[1] * scale[1];\n const maxY = box[4] * scale[1];\n const minZ = box[2] * scale[2];\n const maxZ = box[5] * scale[2];\n\n // handle negative scaling by ensuring min <= max for each axis\n out[0] = Math.min(minX, maxX);\n out[3] = Math.max(minX, maxX);\n out[1] = Math.min(minY, maxY);\n out[4] = Math.max(minY, maxY);\n out[2] = Math.min(minZ, maxZ);\n out[5] = Math.max(minZ, maxZ);\n\n return out;\n}\n\n/**\n * Transform a bounding box by a 4x4 matrix.\n * Uses Arvo's trick — transform the center, build new half-extents from\n * |M| · extents — which is ~4× fewer ops than transforming all 8 corners.\n * Reference: Jim Arvo, \"Transforming Axis-Aligned Bounding Boxes\",\n * Graphics Gems I (1990).\n * https://github.com/erich666/GraphicsGems/blob/master/gems/TransBox.c\n * Assumes mat is affine (no perspective), which is always true for AABB\n * transforms in practice.\n * Safe under aliasing (out and box may be the same array): all six box\n * components are read into locals before out is written.\n * @param out - The output Box3\n * @param box - The input Box3\n * @param mat - The 4x4 transformation matrix\n * @returns The transformed Box3\n */\nexport function transformMat4(out: Box3, box: Box3, mat: Mat4): Box3 {\n const bMinX = box[0];\n const bMinY = box[1];\n const bMinZ = box[2];\n const bMaxX = box[3];\n const bMaxY = box[4];\n const bMaxZ = box[5];\n\n // empty input → empty output (preserve sentinel rather than producing\n // a bogus transformed box from negative extents)\n if (bMinX > bMaxX || bMinY > bMaxY || bMinZ > bMaxZ) {\n out[0] = Number.POSITIVE_INFINITY;\n out[1] = Number.POSITIVE_INFINITY;\n out[2] = Number.POSITIVE_INFINITY;\n out[3] = Number.NEGATIVE_INFINITY;\n out[4] = Number.NEGATIVE_INFINITY;\n out[5] = Number.NEGATIVE_INFINITY;\n return out;\n }\n\n const cx = (bMinX + bMaxX) * 0.5;\n const cy = (bMinY + bMaxY) * 0.5;\n const cz = (bMinZ + bMaxZ) * 0.5;\n const ex = (bMaxX - bMinX) * 0.5;\n const ey = (bMaxY - bMinY) * 0.5;\n const ez = (bMaxZ - bMinZ) * 0.5;\n\n const m0 = mat[0],\n m1 = mat[1],\n m2 = mat[2];\n const m4 = mat[4],\n m5 = mat[5],\n m6 = mat[6];\n const m8 = mat[8],\n m9 = mat[9],\n m10 = mat[10];\n\n const tcx = m0 * cx + m4 * cy + m8 * cz + mat[12];\n const tcy = m1 * cx + m5 * cy + m9 * cz + mat[13];\n const tcz = m2 * cx + m6 * cy + m10 * cz + mat[14];\n\n const tex = Math.abs(m0) * ex + Math.abs(m4) * ey + Math.abs(m8) * ez;\n const tey = Math.abs(m1) * ex + Math.abs(m5) * ey + Math.abs(m9) * ez;\n const tez = Math.abs(m2) * ex + Math.abs(m6) * ey + Math.abs(m10) * ez;\n\n out[0] = tcx - tex;\n out[1] = tcy - tey;\n out[2] = tcz - tez;\n out[3] = tcx + tex;\n out[4] = tcy + tey;\n out[5] = tcz + tez;\n\n return out;\n}\n\n/**\n * Test if a point is contained within the bounding box\n * @param box - The bounding box\n * @param point - The point to test\n * @returns true if the point is inside or on the boundary of the box\n */\nexport function containsPoint(box: Box3, point: Vec3): boolean {\n return (\n point[0] >= box[0] &&\n point[0] <= box[3] &&\n point[1] >= box[1] &&\n point[1] <= box[4] &&\n point[2] >= box[2] &&\n point[2] <= box[5]\n );\n}\n\n/**\n * Test if one Box3 completely contains another Box3\n * @param container - The potentially containing Box3\n * @param contained - The Box3 that might be contained\n * @returns true if the container Box3 completely contains the contained Box3\n */\nexport function containsBox3(container: Box3, contained: Box3): boolean {\n return (\n contained[0] >= container[0] &&\n contained[3] <= container[3] &&\n contained[1] >= container[1] &&\n contained[4] <= container[4] &&\n contained[2] >= container[2] &&\n contained[5] <= container[5]\n );\n}\n\n/**\n * Check whether two bounding boxes intersect\n */\nexport function intersectsBox3(boxA: Box3, boxB: Box3): boolean {\n return (\n boxA[0] <= boxB[3] &&\n boxA[3] >= boxB[0] &&\n boxA[1] <= boxB[4] &&\n boxA[4] >= boxB[1] &&\n boxA[2] <= boxB[5] &&\n boxA[5] >= boxB[2]\n );\n}\n\n/**\n * Test whether an axis-aligned bounding box intersects a triangle, via the\n * separating-axis theorem over 13 axes: the 3 box face normals, the triangle\n * face normal, and the 9 box-axis × triangle-edge cross products.\n *\n * Fully inlined with local scalars — no scratch arrays or per-call allocations.\n * Axes are tested cheapest-first (box faces, i.e. the triangle-vs-box AABB\n * reject) so the common non-overlapping case exits before any edge or cross\n * product is computed. On each edge-cross axis two of the three vertices project\n * to the same value (the axis is perpendicular to that edge), so only two\n * projections are needed. An all-zero cross axis (edge parallel to a box axis)\n * collapses every projection and the radius to 0, passing automatically.\n */\nexport function intersectsTriangle3(box: Box3, a: Vec3, b: Vec3, c: Vec3): boolean {\n // Empty box quick reject\n if (box[0] > box[3] || box[1] > box[4] || box[2] > box[5]) return false;\n\n // Box center and half-extents\n const cx = (box[0] + box[3]) * 0.5;\n const cy = (box[1] + box[4]) * 0.5;\n const cz = (box[2] + box[5]) * 0.5;\n const ex = box[3] - cx;\n const ey = box[4] - cy;\n const ez = box[5] - cz;\n\n // Triangle vertices relative to the box center\n const v0x = a[0] - cx;\n const v0y = a[1] - cy;\n const v0z = a[2] - cz;\n const v1x = b[0] - cx;\n const v1y = b[1] - cy;\n const v1z = b[2] - cz;\n const v2x = c[0] - cx;\n const v2y = c[1] - cy;\n const v2z = c[2] - cz;\n\n // 3 box face normals first: this is the triangle-AABB vs box reject and\n // knocks out most non-overlapping pairs before any further work.\n if (Math.min(v0x, v1x, v2x) > ex || Math.max(v0x, v1x, v2x) < -ex) return false;\n if (Math.min(v0y, v1y, v2y) > ey || Math.max(v0y, v1y, v2y) < -ey) return false;\n if (Math.min(v0z, v1z, v2z) > ez || Math.max(v0z, v1z, v2z) < -ez) return false;\n\n // Triangle edge vectors\n const f0x = v1x - v0x;\n const f0y = v1y - v0y;\n const f0z = v1z - v0z;\n const f1x = v2x - v1x;\n const f1y = v2y - v1y;\n const f1z = v2z - v1z;\n const f2x = v0x - v2x;\n const f2y = v0y - v2y;\n const f2z = v0z - v2z;\n\n let pa: number;\n let pb: number;\n let r: number;\n\n // Triangle face normal (all three vertices share one projection)\n const nx = f0y * f1z - f0z * f1y;\n const ny = f0z * f1x - f0x * f1z;\n const nz = f0x * f1y - f0y * f1x;\n const d = v0x * nx + v0y * ny + v0z * nz;\n r = ex * Math.abs(nx) + ey * Math.abs(ny) + ez * Math.abs(nz);\n if (d > r || d < -r) return false;\n\n // 9 axes: box axis × triangle edge. The axis is perpendicular to its edge,\n // so the two vertices on that edge project equally — only two projections\n // (pa, pb) differ.\n // box X (1,0,0) × edge => (0, -fz, fy)\n pa = v0z * f0y - v0y * f0z;\n pb = v2z * f0y - v2y * f0z;\n r = ey * Math.abs(f0z) + ez * Math.abs(f0y);\n if (Math.min(pa, pb) > r || Math.max(pa, pb) < -r) return false;\n\n pa = v0z * f1y - v0y * f1z;\n pb = v1z * f1y - v1y * f1z;\n r = ey * Math.abs(f1z) + ez * Math.abs(f1y);\n if (Math.min(pa, pb) > r || Math.max(pa, pb) < -r) return false;\n\n pa = v0z * f2y - v0y * f2z;\n pb = v1z * f2y - v1y * f2z;\n r = ey * Math.abs(f2z) + ez * Math.abs(f2y);\n if (Math.min(pa, pb) > r || Math.max(pa, pb) < -r) return false;\n\n // box Y (0,1,0) × edge => (fz, 0, -fx)\n pa = v0x * f0z - v0z * f0x;\n pb = v2x * f0z - v2z * f0x;\n r = ex * Math.abs(f0z) + ez * Math.abs(f0x);\n if (Math.min(pa, pb) > r || Math.max(pa, pb) < -r) return false;\n\n pa = v0x * f1z - v0z * f1x;\n pb = v1x * f1z - v1z * f1x;\n r = ex * Math.abs(f1z) + ez * Math.abs(f1x);\n if (Math.min(pa, pb) > r || Math.max(pa, pb) < -r) return false;\n\n pa = v0x * f2z - v0z * f2x;\n pb = v1x * f2z - v1z * f2x;\n r = ex * Math.abs(f2z) + ez * Math.abs(f2x);\n if (Math.min(pa, pb) > r || Math.max(pa, pb) < -r) return false;\n\n // box Z (0,0,1) × edge => (-fy, fx, 0)\n pa = v0y * f0x - v0x * f0y;\n pb = v2y * f0x - v2x * f0y;\n r = ex * Math.abs(f0y) + ey * Math.abs(f0x);\n if (Math.min(pa, pb) > r || Math.max(pa, pb) < -r) return false;\n\n pa = v0y * f1x - v0x * f1y;\n pb = v1y * f1x - v1x * f1y;\n r = ex * Math.abs(f1y) + ey * Math.abs(f1x);\n if (Math.min(pa, pb) > r || Math.max(pa, pb) < -r) return false;\n\n pa = v0y * f2x - v0x * f2y;\n pb = v1y * f2x - v1x * f2y;\n r = ex * Math.abs(f2y) + ey * Math.abs(f2x);\n if (Math.min(pa, pb) > r || Math.max(pa, pb) < -r) return false;\n\n return true;\n}\n\n/**\n * Test intersection between axis-aligned bounding box and a sphere.\n */\nexport function intersectsSphere(box: Box3, sphere: Sphere): boolean {\n const { center, radius } = sphere;\n const cx = center[0];\n const cy = center[1];\n const cz = center[2];\n // distance from the sphere centre to the box along each axis (0 when inside)\n const dx = cx < box[0] ? box[0] - cx : cx > box[3] ? cx - box[3] : 0;\n const dy = cy < box[1] ? box[1] - cy : cy > box[4] ? cy - box[4] : 0;\n const dz = cz < box[2] ? box[2] - cz : cz > box[5] ? cz - box[5] : 0;\n return dx * dx + dy * dy + dz * dz <= radius * radius;\n}\n\n/**\n * Test intersection between axis-aligned bounding box and plane.\n */\nexport function intersectsPlane3(box: Box3, plane: Plane3): boolean {\n const { normal, constant } = plane;\n const nx = normal[0];\n const ny = normal[1];\n const nz = normal[2];\n\n // Signed distance from the box centre to the plane, and the box's projected\n // half-extent (radius) onto the normal. Branchless equivalent of picking the\n // near/far corners per axis: the box straddles the plane iff |s| <= r.\n // Everything is kept at 2x scale (centre*2, extent*2) so the per-axis 0.5\n // factors drop out; the |s| <= r test is unaffected.\n const s = nx * (box[0] + box[3]) + ny * (box[1] + box[4]) + nz * (box[2] + box[5]) + 2 * constant;\n const r = Math.abs(nx) * (box[3] - box[0]) + Math.abs(ny) * (box[4] - box[1]) + Math.abs(nz) * (box[5] - box[2]);\n return s <= r && s >= -r;\n}\n"],"names":[],"mappings":";;AASA;;;AAGG;SACa,MAAM,GAAA;IAClB,OAAO;AACH,QAAA,MAAM,CAAC,iBAAiB;AACxB,QAAA,MAAM,CAAC,iBAAiB;AACxB,QAAA,MAAM,CAAC,iBAAiB;AACxB,QAAA,MAAM,CAAC,iBAAiB;AACxB,QAAA,MAAM,CAAC,iBAAiB;AACxB,QAAA,MAAM,CAAC,iBAAiB;KAC3B;AACL;AAEA;;;;AAIG;AACG,SAAU,KAAK,CAAC,GAAS,EAAA;AAC3B,IAAA,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC;AAC3D;AAEA;;;;;AAKG;AACG,SAAU,IAAI,CAAC,GAAS,EAAE,GAAS,EAAA;IACrC,GAAG,CAAC,CAAC,CAAC,GAAG,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,EAAE,GAAG,MAAM,CAAC,CAAC,CAAC;AACpB,IAAA,MAAM,EAAE,GAAG,MAAM,CAAC,CAAC,CAAC;;;;;;IAOpB,MAAM,CAAC,GAAG,EAAE,IAAI,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,IAAI,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,IAAI,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,QAAQ;IACjG,MAAM,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;IAChH,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC5B;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"circle.js","sources":["../../src/shapes/circle.ts"],"sourcesContent":["import type { Vec2 } from '../core/vec2';\n\n/** A circle in 2D space */\nexport type Circle = { center: Vec2; radius: number };\n\nexport function create(): Circle {\n return { center: [0, 0], radius: 0 };\n}\n"],"names":[],"mappings":"SAKgB,MAAM,GAAA;AAClB,IAAA,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE;AACxC;;;;"}
|