@woosh/meep-engine 2.163.8 → 2.163.10
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 +1 -1
- package/src/core/collection/heap/IndexedFloatMaxHeap.d.ts.map +1 -0
- package/src/core/{graph/metis/native/refine → collection/heap}/IndexedFloatMaxHeap.js +1 -1
- package/src/core/geom/2d/line/line_segment_intersection_fraction_2d.d.ts +4 -2
- package/src/core/geom/2d/line/line_segment_intersection_fraction_2d.d.ts.map +1 -1
- package/src/core/geom/2d/line/line_segment_intersection_fraction_2d.js +6 -4
- package/src/core/geom/3d/topology/struct/binary/io/bt_mesh_simplify.d.ts.map +1 -1
- package/src/core/geom/3d/topology/struct/binary/io/bt_mesh_simplify.js +2 -26
- package/src/core/geom/3d/topology/struct/binary/io/bt_mesh_simplify_by_error.d.ts +19 -0
- package/src/core/geom/3d/topology/struct/binary/io/bt_mesh_simplify_by_error.d.ts.map +1 -0
- package/src/core/geom/3d/topology/struct/binary/io/bt_mesh_simplify_by_error.js +555 -0
- package/src/core/geom/3d/topology/struct/binary/io/edge/bt_edge_swap_vertex_slots.d.ts +13 -0
- package/src/core/geom/3d/topology/struct/binary/io/edge/bt_edge_swap_vertex_slots.d.ts.map +1 -0
- package/src/core/geom/3d/topology/struct/binary/io/edge/bt_edge_swap_vertex_slots.js +28 -0
- package/src/core/graph/metis/native/bisection/BisectionScratch.d.ts +1 -1
- package/src/core/graph/metis/native/bisection/BisectionScratch.d.ts.map +1 -1
- package/src/core/graph/metis/native/bisection/BisectionScratch.js +1 -1
- package/src/core/graph/metis/native/refine/RefinementScratch.d.ts +1 -1
- package/src/core/graph/metis/native/refine/RefinementScratch.d.ts.map +1 -1
- package/src/core/graph/metis/native/refine/RefinementScratch.js +1 -1
- package/src/engine/navigation/mesh/NavigationMesh.d.ts +6 -0
- package/src/engine/navigation/mesh/NavigationMesh.d.ts.map +1 -1
- package/src/engine/navigation/mesh/NavigationMesh.js +145 -234
- package/src/engine/navigation/mesh/PATHFINDING_PLAN.md +61 -17
- package/src/engine/navigation/mesh/{navmesh_polyanya_find_path.d.ts → bt_mesh_face_find_path_polyanya.d.ts} +2 -2
- package/src/engine/navigation/mesh/bt_mesh_face_find_path_polyanya.d.ts.map +1 -0
- package/src/engine/navigation/mesh/{navmesh_polyanya_find_path.js → bt_mesh_face_find_path_polyanya.js} +117 -48
- package/src/engine/navigation/mesh/build/navmesh_build_topology.d.ts.map +1 -1
- package/src/engine/navigation/mesh/build/navmesh_build_topology.js +25 -0
- package/src/engine/navigation/mesh/bvh_segment_penetrates_mesh.d.ts +21 -0
- package/src/engine/navigation/mesh/bvh_segment_penetrates_mesh.d.ts.map +1 -0
- package/src/engine/navigation/mesh/bvh_segment_penetrates_mesh.js +133 -0
- package/src/core/graph/metis/native/refine/IndexedFloatMaxHeap.d.ts.map +0 -1
- package/src/engine/navigation/mesh/navmesh_polyanya_find_path.d.ts.map +0 -1
- /package/src/core/{graph/metis/native/refine → collection/heap}/IndexedFloatMaxHeap.d.ts +0 -0
package/package.json
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"description": "Pure JavaScript game engine. Fully featured and production ready.",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"author": "Alexander Goldring",
|
|
9
|
-
"version": "2.163.
|
|
9
|
+
"version": "2.163.10",
|
|
10
10
|
"main": "build/meep.module.js",
|
|
11
11
|
"module": "build/meep.module.js",
|
|
12
12
|
"exports": {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IndexedFloatMaxHeap.d.ts","sourceRoot":"","sources":["../../../../../src/core/collection/heap/IndexedFloatMaxHeap.js"],"names":[],"mappings":"AA6BA;IACI;;;OAGG;IACH,yBAHW,MAAM,0BACN,MAAM,EAsBhB;IAbG,wBAA4C;IAC5C,eAAe;IAEf,2BAA4E;IAC5E,2BAAwD;IACxD,6BAA0D;IAE1D;;;OAGG;IACH,cAFU,WAAW,CAE2B;IAIpD,mBAEC;IAED;;;OAGG;IACH,cAQC;IAED,2BAEC;IAED;;;OAGG;IACH,qBAkBC;IAED;;;;OAIG;IACH,oBAsBC;IAED;;;;OAIG;IACH,kBAYC;IAED,wBAUC;IAED;;;OAGG;IACH,WAHW,MAAM,SACN,MAAM,QAehB;IAED;;OAEG;IACH,WAFa,MAAM,CAuBlB;IAED;;;OAGG;IACH,WAHW,MAAM,aACN,MAAM,QAehB;IAED;;;OAGG;IACH,WAHW,MAAM,GACJ,OAAO,CA+BnB;CACJ"}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Fraction `t` in [0,1] along the segment (s0 -> s1) at which the infinite line through (l0, l1)
|
|
3
|
-
* crosses it. Returns
|
|
4
|
-
* the segment) or the two are parallel/collinear.
|
|
3
|
+
* crosses it. Returns -1 when the segment lies entirely on one side of the line (no crossing within
|
|
4
|
+
* the segment) or the two are parallel/collinear. -1 is a value the valid fraction can never take (a
|
|
5
|
+
* real crossing is always in [0,1]), and it is used instead of NaN so callers reject the no-crossing
|
|
6
|
+
* case with a trivial comparison (`t < 0` / `=== -1`) rather than the slower Number.isNaN.
|
|
5
7
|
*
|
|
6
8
|
* Unlike {@link line_segment_compute_line_segment_intersection_array_2d}, the first pair of points
|
|
7
9
|
* defines an unbounded line (not a segment) and the result is the parametric position on the segment
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"line_segment_intersection_fraction_2d.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/2d/line/line_segment_intersection_fraction_2d.js"],"names":[],"mappings":"AAEA
|
|
1
|
+
{"version":3,"file":"line_segment_intersection_fraction_2d.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/2d/line/line_segment_intersection_fraction_2d.js"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,4DAVW,MAAM,QACN,MAAM,QACN,MAAM,QACN,MAAM,QACN,MAAM,QACN,MAAM,QACN,MAAM,QACN,MAAM,GACJ,MAAM,CAsBlB"}
|
|
@@ -2,8 +2,10 @@ import { v2_cross_product } from "../../vec2/v2_cross_product.js";
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Fraction `t` in [0,1] along the segment (s0 -> s1) at which the infinite line through (l0, l1)
|
|
5
|
-
* crosses it. Returns
|
|
6
|
-
* the segment) or the two are parallel/collinear.
|
|
5
|
+
* crosses it. Returns -1 when the segment lies entirely on one side of the line (no crossing within
|
|
6
|
+
* the segment) or the two are parallel/collinear. -1 is a value the valid fraction can never take (a
|
|
7
|
+
* real crossing is always in [0,1]), and it is used instead of NaN so callers reject the no-crossing
|
|
8
|
+
* case with a trivial comparison (`t < 0` / `=== -1`) rather than the slower Number.isNaN.
|
|
7
9
|
*
|
|
8
10
|
* Unlike {@link line_segment_compute_line_segment_intersection_array_2d}, the first pair of points
|
|
9
11
|
* defines an unbounded line (not a segment) and the result is the parametric position on the segment
|
|
@@ -30,12 +32,12 @@ export function line_segment_intersection_fraction_2d(
|
|
|
30
32
|
const side_1 = v2_cross_product(dir_x, dir_y, s1_x - l0_x, s1_y - l0_y);
|
|
31
33
|
|
|
32
34
|
if ((side_0 > 0 && side_1 > 0) || (side_0 < 0 && side_1 < 0)) {
|
|
33
|
-
return
|
|
35
|
+
return -1; // both endpoints on the same side -> no crossing within the segment
|
|
34
36
|
}
|
|
35
37
|
|
|
36
38
|
const denom = side_0 - side_1;
|
|
37
39
|
if (denom === 0) {
|
|
38
|
-
return
|
|
40
|
+
return -1; // parallel / collinear
|
|
39
41
|
}
|
|
40
42
|
|
|
41
43
|
return side_0 / denom;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bt_mesh_simplify.d.ts","sourceRoot":"","sources":["../../../../../../../../../src/core/geom/3d/topology/struct/binary/io/bt_mesh_simplify.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"bt_mesh_simplify.d.ts","sourceRoot":"","sources":["../../../../../../../../../src/core/geom/3d/topology/struct/binary/io/bt_mesh_simplify.js"],"names":[],"mappings":"AA6JA;;;;;;;;;;;;;;GAcG;AACH,0EAHW,MAAM,wBACN,IAAI,MAAM,CAAC,QA6HrB"}
|
|
@@ -7,6 +7,7 @@ import { bt_mesh_compute_vertex_quadratics } from "./bt_mesh_compute_vertex_quad
|
|
|
7
7
|
import { bt_edge_collapse } from "./edge/bt_edge_collapse.js";
|
|
8
8
|
import { bt_edge_kill } from "./edge/bt_edge_kill.js";
|
|
9
9
|
import { bt_edge_kill_parallels } from "./edge/bt_edge_kill_parallels.js";
|
|
10
|
+
import { bt_edge_swap_vertex_slots } from "./edge/bt_edge_swap_vertex_slots.js";
|
|
10
11
|
import { bt_vert_fuse_duplicate_edges } from "./vertex/bt_vert_fuse_duplicate_edges.js";
|
|
11
12
|
import { bt_vert_kill } from "./vertex/bt_vert_kill.js";
|
|
12
13
|
|
|
@@ -50,31 +51,6 @@ function count_edge_faces(mesh, edge_id) {
|
|
|
50
51
|
return count;
|
|
51
52
|
}
|
|
52
53
|
|
|
53
|
-
/**
|
|
54
|
-
* Swap the v1/v2 slots of an edge. Disk cycle pointers for the two slots are swapped
|
|
55
|
-
* alongside so that the disk cycles on both attached vertices remain valid.
|
|
56
|
-
*
|
|
57
|
-
* @param {BinaryTopology} mesh
|
|
58
|
-
* @param {number} edge_id
|
|
59
|
-
*/
|
|
60
|
-
function swap_edge_vertex_slots(mesh, edge_id) {
|
|
61
|
-
const v1 = mesh.edge_read_vertex1(edge_id);
|
|
62
|
-
const v2 = mesh.edge_read_vertex2(edge_id);
|
|
63
|
-
|
|
64
|
-
const v1_next = mesh.edge_read_v1_disk_next(edge_id);
|
|
65
|
-
const v1_prev = mesh.edge_read_v1_disk_prev(edge_id);
|
|
66
|
-
const v2_next = mesh.edge_read_v2_disk_next(edge_id);
|
|
67
|
-
const v2_prev = mesh.edge_read_v2_disk_prev(edge_id);
|
|
68
|
-
|
|
69
|
-
mesh.edge_write_vertex1(edge_id, v2);
|
|
70
|
-
mesh.edge_write_vertex2(edge_id, v1);
|
|
71
|
-
|
|
72
|
-
mesh.edge_write_v1_disk_next(edge_id, v2_next);
|
|
73
|
-
mesh.edge_write_v1_disk_prev(edge_id, v2_prev);
|
|
74
|
-
mesh.edge_write_v2_disk_next(edge_id, v1_next);
|
|
75
|
-
mesh.edge_write_v2_disk_prev(edge_id, v1_prev);
|
|
76
|
-
}
|
|
77
|
-
|
|
78
54
|
/**
|
|
79
55
|
* Evaluate a potential edge collapse: choose the optimal surviving vertex position
|
|
80
56
|
* and return the quadric-based cost. Returns Infinity if the edge cannot be collapsed.
|
|
@@ -285,7 +261,7 @@ export function bt_mesh_simplify(
|
|
|
285
261
|
// bt_edge_collapse keeps v1 as the survivor. If v2 is the pinned endpoint,
|
|
286
262
|
// swap the edge's slots so the pinned vertex ends up in the v1 position.
|
|
287
263
|
if (v2_restricted) {
|
|
288
|
-
|
|
264
|
+
bt_edge_swap_vertex_slots(mesh, edge_id);
|
|
289
265
|
}
|
|
290
266
|
|
|
291
267
|
const pre_survivor = mesh.edge_read_vertex1(edge_id);
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Clean up a triangle mesh in place by removing only geometrically redundant vertices, so the
|
|
3
|
+
* surface and its boundary are preserved to within `max_error`. Unlike {@link bt_mesh_simplify}
|
|
4
|
+
* (quadric LoD decimation driven to a face-count target, free to relocate vertices), this is a
|
|
5
|
+
* conservative half-edge cleanup: it never moves a surviving vertex and never changes the
|
|
6
|
+
* boundary outline or hole topology by more than `max_error`. It removes the dense interior of
|
|
7
|
+
* flat/near-coplanar regions and collinear runs of boundary vertices, and stops once the
|
|
8
|
+
* cheapest remaining collapse would exceed the tolerance.
|
|
9
|
+
*
|
|
10
|
+
* Intended for navmesh post-processing, where the input is a walkable surface whose outline and
|
|
11
|
+
* holes (obstacle footprints) carry meaning and must not drift, but whose interior inherits far
|
|
12
|
+
* more triangles than navigation needs.
|
|
13
|
+
*
|
|
14
|
+
* @param {BinaryTopology} mesh Mesh to clean up in-place.
|
|
15
|
+
* @param {number} max_error Maximum world-space deviation allowed for any removed vertex and for
|
|
16
|
+
* the boundary polyline. A no-op when <= 0.
|
|
17
|
+
*/
|
|
18
|
+
export function bt_mesh_simplify_by_error(mesh: BinaryTopology, max_error: number): void;
|
|
19
|
+
//# sourceMappingURL=bt_mesh_simplify_by_error.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bt_mesh_simplify_by_error.d.ts","sourceRoot":"","sources":["../../../../../../../../../src/core/geom/3d/topology/struct/binary/io/bt_mesh_simplify_by_error.js"],"names":[],"mappings":"AA4aA;;;;;;;;;;;;;;;;GAgBG;AACH,2EAHW,MAAM,QAgHhB"}
|