@woosh/meep-engine 2.131.38 → 2.131.39
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/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"description": "Pure JavaScript game engine. Fully featured and production ready.",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"author": "Alexander Goldring",
|
|
8
|
-
"version": "2.131.
|
|
8
|
+
"version": "2.131.39",
|
|
9
9
|
"main": "build/meep.module.js",
|
|
10
10
|
"module": "build/meep.module.js",
|
|
11
11
|
"exports": {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aabb3_signed_distance_sqr_to_point.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/3d/aabb/aabb3_signed_distance_sqr_to_point.js"],"names":[],"mappings":"AAEA;;;;;;;;;;;;GAYG;AACH,uDAXW,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,WACN,MAAM,WACN,MAAM,WACN,MAAM,GACJ,MAAM,
|
|
1
|
+
{"version":3,"file":"aabb3_signed_distance_sqr_to_point.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/3d/aabb/aabb3_signed_distance_sqr_to_point.js"],"names":[],"mappings":"AAEA;;;;;;;;;;;;GAYG;AACH,uDAXW,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,WACN,MAAM,WACN,MAAM,WACN,MAAM,GACJ,MAAM,CAmClB"}
|
|
@@ -31,18 +31,20 @@ export function aabb3_signed_distance_sqr_to_point(
|
|
|
31
31
|
let dy = max2(yp0, yp1);
|
|
32
32
|
let dz = max2(zp0, zp1);
|
|
33
33
|
|
|
34
|
+
const max_dist = Math.max(dx, dy, dz);
|
|
34
35
|
|
|
35
|
-
if (
|
|
36
|
+
if (max_dist > 0) {
|
|
36
37
|
// non-penetrating, clamp axis
|
|
37
38
|
dx = max2(dx, 0);
|
|
38
39
|
dy = max2(dy, 0);
|
|
39
40
|
dz = max2(dz, 0);
|
|
40
41
|
|
|
41
|
-
//straight-line distance
|
|
42
|
+
// straight-line distance
|
|
42
43
|
return dx * dx + dy * dy + dz * dz;
|
|
43
44
|
} else {
|
|
44
|
-
|
|
45
|
-
|
|
45
|
+
|
|
46
|
+
// penetration, negative distance
|
|
47
|
+
return -(max_dist * max_dist);
|
|
46
48
|
}
|
|
47
49
|
}
|
|
48
50
|
|