@woosh/meep-engine 2.119.38 → 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.38",
8
+ "version": "2.119.39",
9
9
  "main": "build/meep.module.js",
10
10
  "module": "build/meep.module.js",
11
11
  "exports": {
@@ -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"}
@@ -115,23 +115,23 @@ export function query_bvh_geometry_nearest(
115
115
 
116
116
  if (distance_sqr_to_child1 < distance_sqr_to_child2) {
117
117
 
118
- // if (distance_sqr_to_child2 < nearest_distance_sqr) {
118
+ if (distance_sqr_to_child2 < nearest_distance_sqr) {
119
119
  stack[pointer++] = child_2;
120
- // }
120
+ }
121
121
 
122
- // if (distance_sqr_to_child1 < nearest_distance_sqr) {
122
+ if (distance_sqr_to_child1 < nearest_distance_sqr) {
123
123
  stack[pointer++] = child_1;
124
- // }
124
+ }
125
125
 
126
126
  } else {
127
127
 
128
- // if (distance_sqr_to_child1 < nearest_distance_sqr) {
128
+ if (distance_sqr_to_child1 < nearest_distance_sqr) {
129
129
  stack[pointer++] = child_1;
130
- // }
130
+ }
131
131
 
132
- // if (distance_sqr_to_child2 < nearest_distance_sqr) {
132
+ if (distance_sqr_to_child2 < nearest_distance_sqr) {
133
133
  stack[pointer++] = child_2;
134
- // }
134
+ }
135
135
 
136
136
  }
137
137
 
@@ -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