@woosh/meep-engine 2.119.37 → 2.119.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": "Fully featured ECS game engine written in JavaScript",
6
6
  "type": "module",
7
7
  "author": "Alexander Goldring",
8
- "version": "2.119.37",
8
+ "version": "2.119.39",
9
9
  "main": "build/meep.module.js",
10
10
  "module": "build/meep.module.js",
11
11
  "exports": {
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Compute squared distance to point, value is negative if the point is inside the box
2
+ * Compute squared distance to point, value is 0 if the point is inside the box
3
3
  * @param {number} x0
4
4
  * @param {number} y0
5
5
  * @param {number} z0
@@ -1,7 +1,7 @@
1
1
  import { max3 } from "../../../math/max3.js";
2
2
 
3
3
  /**
4
- * Compute squared distance to point, value is negative if the point is inside the box
4
+ * Compute squared distance to point, value is 0 if the point is inside the box
5
5
  * @param {number} x0
6
6
  * @param {number} y0
7
7
  * @param {number} z0
@@ -25,6 +25,7 @@ export function computeTriangleClosestPointToPointBarycentric(
25
25
  bx, by, bz,
26
26
  cx, cy, cz
27
27
  ){
28
+ // adapted from https://github.com/mrdoob/three.js/blob/676e85dc7cd5971a6565c4152e9e6d8bdd20a2b7/src/math/Triangle.js#L222
28
29
 
29
30
  let v, w;
30
31
 
@@ -1 +1 @@
1
- {"version":3,"file":"query_bvh_geometry_nearest.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/graphics/geometry/buffered/query/query_bvh_geometry_nearest.js"],"names":[],"mappings":"AAwBA;;;;;;;;;;;GAWG;AACH,uFARW,MAAM,EAAE,GAAC,YAAY,WACrB,MAAM,EAAE,GAAC,WAAW,GAAC,WAAW,KAChC,MAAM,KACN,MAAM,KACN,MAAM,gBACN,MAAM,GACL,OAAO,CA0KlB"}
1
+ {"version":3,"file":"query_bvh_geometry_nearest.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/graphics/geometry/buffered/query/query_bvh_geometry_nearest.js"],"names":[],"mappings":"AAwBA;;;;;;;;;;;GAWG;AACH,uFARW,MAAM,EAAE,GAAC,YAAY,WACrB,MAAM,EAAE,GAAC,WAAW,GAAC,WAAW,KAChC,MAAM,KACN,MAAM,KACN,MAAM,gBACN,MAAM,GACL,OAAO,CA2KlB"}
@@ -172,12 +172,13 @@ export function query_bvh_geometry_nearest(
172
172
 
173
173
  const u = v3_scratch_0[0];
174
174
  const v = v3_scratch_0[1];
175
+ const w = 1 - u - v;
175
176
 
176
177
  // construct edge
177
178
 
178
- const contact_x = (bx - ax) * u + (cx - ax) * v + ax;
179
- const contact_y = (by - ay) * u + (cy - ay) * v + ay;
180
- const contact_z = (bz - az) * u + (cz - az) * v + az;
179
+ const contact_x = (bx - ax) * v + (cx - ax) * w + ax;
180
+ const contact_y = (by - ay) * v + (cy - ay) * w + ay;
181
+ const contact_z = (bz - az) * v + (cz - az) * w + az;
181
182
 
182
183
  const distance_to_triangle_sqr = v3_distance_sqr(contact_x, contact_y, contact_z, x, y, z);
183
184