@woosh/meep-engine 2.48.20 → 2.48.22
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/{engine/graphics/micron/build/clustering → core/geom/3d/topology/util}/compute_face_connection_weight.js +40 -35
- package/src/core/graph/build_face_graph_from_mesh.js +1 -1
- package/src/engine/graphics/ecs/mesh-v2/sample/load_gltf.js +0 -3
- package/src/engine/graphics/micron/MICRON_GEOMETRY_FIELD.js +0 -1
- package/src/engine/graphics/micron/MICRON_URI_FIELD.js +0 -1
- package/src/engine/graphics/micron/build/MICRON_PATCH_SIZE_MAX.js +0 -5
- package/src/engine/graphics/micron/build/PatchRepresentation.js +0 -424
- package/src/engine/graphics/micron/build/buildMicronGeometryFromBufferGeometry.js +0 -311
- package/src/engine/graphics/micron/build/build_geometry_info.js +0 -21
- package/src/engine/graphics/micron/build/clustering/assignInitialPatchNeighbours.js +0 -63
- package/src/engine/graphics/micron/build/clustering/assign_patch_neighbours_from_topology.js +0 -46
- package/src/engine/graphics/micron/build/clustering/build_clustering_2.js +0 -37
- package/src/engine/graphics/micron/build/clustering/build_leaf_patches.js +0 -326
- package/src/engine/graphics/micron/build/clustering/build_leaf_patches_metis.js +0 -76
- package/src/engine/graphics/micron/build/clustering/computeBorderLengthChange.js +0 -59
- package/src/engine/graphics/micron/build/clustering/computeFaceCurvatureScore.js +0 -57
- package/src/engine/graphics/micron/build/clustering/computeOpenFaceFreedom.js +0 -35
- package/src/engine/graphics/micron/build/clustering/populateOpenFaceNeighboursForPatch.js +0 -56
- package/src/engine/graphics/micron/build/clustering/validate_leaf_patch_connectivity.js +0 -44
- package/src/engine/graphics/micron/build/compute_micron_buffer_array_constructor.js +0 -24
- package/src/engine/graphics/micron/build/compute_vertex_remap_cost.js +0 -29
- package/src/engine/graphics/micron/build/debug/build_clustering_info.js +0 -58
- package/src/engine/graphics/micron/build/debug/build_graph_info.js +0 -59
- package/src/engine/graphics/micron/build/fill_patch_geometry_data.js +0 -270
- package/src/engine/graphics/micron/build/hierarchy/buildAbstractPatchHierarchy.js +0 -196
- package/src/engine/graphics/micron/build/hierarchy/build_intermediate_patch_topology.js +0 -162
- package/src/engine/graphics/micron/build/hierarchy/build_merge_graph.js +0 -89
- package/src/engine/graphics/micron/build/hierarchy/computePatchMergeScore.js +0 -146
- package/src/engine/graphics/micron/build/hierarchy/compute_patches_shared_vertex_count.js +0 -32
- package/src/engine/graphics/micron/build/hierarchy/compute_patches_shared_vertices.js +0 -34
- package/src/engine/graphics/micron/build/hierarchy/merge_patches.js +0 -581
- package/src/engine/graphics/micron/build/hierarchy/metis_cluster_clusters.js +0 -53
- package/src/engine/graphics/micron/build/hierarchy/optimize_graph_partitioning_balance.js +0 -515
- package/src/engine/graphics/micron/build/hierarchy/patch_combine.js +0 -180
- package/src/engine/graphics/micron/build/hierarchy/patch_fill_holes_by_uncollapse.js +0 -60
- package/src/engine/graphics/micron/build/hierarchy/patch_stitch_parent_border.js +0 -320
- package/src/engine/graphics/micron/build/hierarchy/qvdr_build_simplified_clusters.js +0 -547
- package/src/engine/graphics/micron/build/hierarchy/qvdr_build_tree.js +0 -140
- package/src/engine/graphics/micron/buildPatchwork.js +0 -68
- package/src/engine/graphics/micron/convert_three_object_to_micron.js +0 -179
- package/src/engine/graphics/micron/debug/VirtualGeometryStats.js +0 -42
- package/src/engine/graphics/micron/format/MICRON_GEOMETRY_PROPERTY_NAME.js +0 -1
- package/src/engine/graphics/micron/format/MicronGeometry.d.ts +0 -21
- package/src/engine/graphics/micron/format/MicronGeometry.js +0 -334
- package/src/engine/graphics/micron/format/MicronGeometryPatch.d.ts +0 -3
- package/src/engine/graphics/micron/format/MicronGeometryPatch.js +0 -205
- package/src/engine/graphics/micron/format/MicronGeometryPatchOccurance.js +0 -50
- package/src/engine/graphics/micron/format/ThreeMicronMesh.d.ts +0 -10
- package/src/engine/graphics/micron/format/ThreeMicronMesh.js +0 -45
- package/src/engine/graphics/micron/format/VirtualGeometry.js +0 -158
- package/src/engine/graphics/micron/format/micron_build_proxy_geometry.js +0 -205
- package/src/engine/graphics/micron/format/serialization/MicronGeometryBinarySerializationAdapter.js +0 -123
- package/src/engine/graphics/micron/format/serialization/MicronGeometryBinarySerializationAdapter.spec.js +0 -63
- package/src/engine/graphics/micron/format/serialization/collection/geometry_collection_serialization.js +0 -83
- package/src/engine/graphics/micron/format/serialization/collection/geometry_collection_serialization.spec.js +0 -51
- package/src/engine/graphics/micron/format/serialization/deserialize_attribute_spec.js +0 -25
- package/src/engine/graphics/micron/format/serialization/deserialize_patch.js +0 -106
- package/src/engine/graphics/micron/format/serialization/serialize_attribute_spec.js +0 -18
- package/src/engine/graphics/micron/format/serialization/serialize_patch.js +0 -84
- package/src/engine/graphics/micron/format/validate_patch_bounds.js +0 -69
- package/src/engine/graphics/micron/plugin/GLTFAssetTransformer.js +0 -265
- package/src/engine/graphics/micron/plugin/GLTF_MICRON_ID_FIELD.js +0 -5
- package/src/engine/graphics/micron/plugin/MicronRenderPlugin.d.ts +0 -8
- package/src/engine/graphics/micron/plugin/MicronRenderPlugin.js +0 -150
- package/src/engine/graphics/micron/plugin/serialization/BufferGeometrySerializationAdapter.js +0 -176
- package/src/engine/graphics/micron/plugin/shaded_geometry/MicronShadedGeometryRenderAdapter.js +0 -216
- package/src/engine/graphics/micron/prototypeMicronProxyBuild.js +0 -227
- package/src/engine/graphics/micron/prototypeVirtualGeometry.js +0 -911
- package/src/engine/graphics/micron/render/PatchCacheKey.js +0 -79
- package/src/engine/graphics/micron/render/VIRTUAL_MESH_FLAG.d.ts +0 -1
- package/src/engine/graphics/micron/render/VIRTUAL_MESH_FLAG.js +0 -1
- package/src/engine/graphics/micron/render/VirtualGeometryBuilder.js +0 -207
- package/src/engine/graphics/micron/render/approximateTriangleArea.js +0 -25
- package/src/engine/graphics/micron/render/culling/PatchCullingSystem.js +0 -129
- package/src/engine/graphics/micron/render/instanced/PatchDataTextures.js +0 -329
- package/src/engine/graphics/micron/render/instanced/ThreeInstancedAdapter.js +0 -175
- package/src/engine/graphics/micron/render/instanced/shader/constants.js +0 -3
- package/src/engine/graphics/micron/render/instanced/shader/gen_micron_vertex_attribute_texture_name.js +0 -8
- package/src/engine/graphics/micron/render/instanced/shader/shader_rewrite_standard.js +0 -250
- package/src/engine/graphics/micron/render/makeThreeMeshFromVirtualGeometry.js +0 -37
- package/src/engine/graphics/micron/render/refinement/ActivePatchFlags.js +0 -8
- package/src/engine/graphics/micron/render/refinement/ActivePatchList.js +0 -241
- package/src/engine/graphics/micron/render/refinement/ActivePatchRecord.js +0 -154
- package/src/engine/graphics/micron/render/refinement/RefinementSpec.js +0 -84
- package/src/engine/graphics/micron/render/refinement/get_geometry_patch_cut.js +0 -133
- package/src/engine/graphics/micron/render/refinement/is_patch_facing_back.js +0 -43
- package/src/engine/graphics/micron/render/refinement/is_patch_visible.js +0 -37
- package/src/engine/graphics/micron/render/v1/MaterialContext.js +0 -150
- package/src/engine/graphics/micron/render/v1/MaterialVertexSpec.js +0 -115
- package/src/engine/graphics/micron/render/v1/MicronRenderContext.js +0 -145
- package/src/engine/graphics/micron/render/v1/ThreeVirtualGeometryAdapter.js +0 -255
- package/src/engine/graphics/micron/render/v1/VGThreeRenderer.js +0 -142
- package/src/engine/graphics/micron/render/v1/getTransformedPositionsCached.js +0 -54
- package/src/engine/graphics/micron/simplifyGeometry.js +0 -26
- package/src/engine/graphics/micron/util/patchToBufferGeometry.js +0 -19
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Attempt to recursively fill the holes in topology by undoing simplifications
|
|
3
|
-
* @param {PatchRepresentation} root
|
|
4
|
-
* @param {Map<number,TopoVertex>} vertex_map
|
|
5
|
-
*/
|
|
6
|
-
export function patch_fill_holes_by_uncollapse(root, vertex_map) {
|
|
7
|
-
const open_set = root.children.slice();
|
|
8
|
-
let restored_edge_count = 0;
|
|
9
|
-
let restored_face_count = 0;
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
*
|
|
13
|
-
* @param {EdgeCollapseCandidate} edge
|
|
14
|
-
* @param {PatchRepresentation} source
|
|
15
|
-
*/
|
|
16
|
-
function restoreEdge(edge, source) {
|
|
17
|
-
|
|
18
|
-
const removed_faces = edge.edge.faces;
|
|
19
|
-
|
|
20
|
-
const remove_face_count = removed_faces.length;
|
|
21
|
-
for (let i = 0; i < remove_face_count; i++) {
|
|
22
|
-
const face = removed_faces[i];
|
|
23
|
-
|
|
24
|
-
root.topology_mask.addFaceCopy(face, vertex_map);
|
|
25
|
-
|
|
26
|
-
restored_face_count++;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
while (open_set.length > 0) {
|
|
32
|
-
const patch = open_set.shift();
|
|
33
|
-
|
|
34
|
-
const collapsed_edges = patch.collapsed_edges;
|
|
35
|
-
const collapsed_edge_count = collapsed_edges.length;
|
|
36
|
-
|
|
37
|
-
for (let i = collapsed_edge_count - 1; i >= 0; i--) {
|
|
38
|
-
const edge = collapsed_edges[i];
|
|
39
|
-
|
|
40
|
-
const victim_vertex_index = edge.victim_vertex.index;
|
|
41
|
-
|
|
42
|
-
if (edge.isBorderCollapse()) {
|
|
43
|
-
const already_done = vertex_map.has(victim_vertex_index);
|
|
44
|
-
if (!already_done) {
|
|
45
|
-
// un-collapse
|
|
46
|
-
restoreEdge(edge, patch);
|
|
47
|
-
restored_edge_count++;
|
|
48
|
-
} else {
|
|
49
|
-
// console.log('!');
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
// Array.prototype.push.apply(open_set, patch.children);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
if (restored_edge_count > 0) {
|
|
58
|
-
console.log(`restored ${restored_edge_count}, restored_face_count ${restored_face_count}`);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
@@ -1,320 +0,0 @@
|
|
|
1
|
-
import { isVertexConnectedToOutline } from "../../../../../core/geom/3d/topology/isVertexConnectedToOutline.js";
|
|
2
|
-
import { Graph } from "../../../../../core/graph/v2/Graph.js";
|
|
3
|
-
import { EdgeDirectionType } from "../../../../../core/graph/Edge.js";
|
|
4
|
-
|
|
5
|
-
class V {
|
|
6
|
-
/**
|
|
7
|
-
*
|
|
8
|
-
* @param {number} index
|
|
9
|
-
*/
|
|
10
|
-
constructor(index) {
|
|
11
|
-
this.path = 0;
|
|
12
|
-
this.index = index;
|
|
13
|
-
this.connected = false;
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
*
|
|
17
|
-
* @type {TopoVertex|null}
|
|
18
|
-
*/
|
|
19
|
-
this.topo = null;
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Other vertices that this one can connect to
|
|
23
|
-
* @type {Set<V>}
|
|
24
|
-
*/
|
|
25
|
-
this.connects_to = new Set();
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
*
|
|
32
|
-
* @param {V} from
|
|
33
|
-
* @param {V} to
|
|
34
|
-
* @returns {number}
|
|
35
|
-
*/
|
|
36
|
-
function computeVertexMoveCost(from, to) {
|
|
37
|
-
const topo_to = to.topo;
|
|
38
|
-
const topo_from = from.topo;
|
|
39
|
-
|
|
40
|
-
const distance = topo_from.distanceTo(topo_to);
|
|
41
|
-
|
|
42
|
-
return distance;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
*
|
|
47
|
-
* @param {TopoMesh} mesh
|
|
48
|
-
* @param {PatchRepresentation} a
|
|
49
|
-
* @param {PatchRepresentation} b
|
|
50
|
-
* @param {Map<number,TopoVertex>} vertex_map
|
|
51
|
-
*/
|
|
52
|
-
export function patch_stitch_parent_border(mesh, a, b, vertex_map) {
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
*
|
|
56
|
-
* @type {Map<number, V>}
|
|
57
|
-
*/
|
|
58
|
-
const edge_set = new Map();
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
*
|
|
63
|
-
* @type {Graph<number>}
|
|
64
|
-
*/
|
|
65
|
-
const graph = new Graph();
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
*
|
|
69
|
-
* @type {Map<number, V>}
|
|
70
|
-
*/
|
|
71
|
-
const vertex_registry = new Map();
|
|
72
|
-
|
|
73
|
-
// build a graph for all edge vertices
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
*
|
|
77
|
-
* @param {PatchRepresentation} patch
|
|
78
|
-
* @param {number} source_id
|
|
79
|
-
*/
|
|
80
|
-
function map_forward(patch, source_id) {
|
|
81
|
-
const topo = patch.topology_mask;
|
|
82
|
-
const vertices = topo.vertices;
|
|
83
|
-
const vertex_count = vertices.length;
|
|
84
|
-
for (let i = 0; i < vertex_count; i++) {
|
|
85
|
-
const v = vertices[i];
|
|
86
|
-
|
|
87
|
-
if (!isVertexConnectedToOutline(v)) {
|
|
88
|
-
continue;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
const index = v.index;
|
|
92
|
-
|
|
93
|
-
let v_rep = edge_set.get(index);
|
|
94
|
-
|
|
95
|
-
if (v_rep !== undefined) {
|
|
96
|
-
// already connected
|
|
97
|
-
v_rep.connected = true;
|
|
98
|
-
} else {
|
|
99
|
-
v_rep = new V(index);
|
|
100
|
-
v_rep.topo = v;
|
|
101
|
-
|
|
102
|
-
edge_set.set(index, v_rep);
|
|
103
|
-
|
|
104
|
-
graph.addNode(index);
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
v_rep.path |= source_id;
|
|
108
|
-
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
/**
|
|
113
|
-
*
|
|
114
|
-
* @param {PatchRepresentation} patch
|
|
115
|
-
*/
|
|
116
|
-
function map_back(patch) {
|
|
117
|
-
|
|
118
|
-
// do initial mapping
|
|
119
|
-
const collapsed_edges = patch.collapsed_edges;
|
|
120
|
-
|
|
121
|
-
for (let j = collapsed_edges.length - 1; j >= 0; j--) {
|
|
122
|
-
const collapsedEdge = collapsed_edges[j];
|
|
123
|
-
|
|
124
|
-
if (!collapsedEdge.isBorderCollapse()) {
|
|
125
|
-
// not a border collapse
|
|
126
|
-
continue;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
const victim_vertex = collapsedEdge.victim_vertex;
|
|
130
|
-
const victim_index = victim_vertex.index;
|
|
131
|
-
if (!graph.hasNode(victim_index)) {
|
|
132
|
-
graph.addNode(victim_index);
|
|
133
|
-
|
|
134
|
-
const v = new V(victim_index);
|
|
135
|
-
v.topo = victim_vertex;
|
|
136
|
-
vertex_registry.set(victim_index, v);
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
const target_vertex = collapsedEdge.target_vertex;
|
|
140
|
-
const target_index = target_vertex.index;
|
|
141
|
-
|
|
142
|
-
if (!graph.hasNode(target_index)) {
|
|
143
|
-
// target is not part of the current edge, still need to record it
|
|
144
|
-
graph.addNode(target_index);
|
|
145
|
-
|
|
146
|
-
const rep_v_target = new V(target_index);
|
|
147
|
-
rep_v_target.topo = target_vertex;
|
|
148
|
-
|
|
149
|
-
vertex_registry.set(target_index, rep_v_target)
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
graph.createEdge(target_index, victim_index, EdgeDirectionType.Undirected);
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
const children = patch.children;
|
|
156
|
-
const child_count = children.length;
|
|
157
|
-
|
|
158
|
-
for (let i = 0; i < child_count; i++) {
|
|
159
|
-
const child = children[i];
|
|
160
|
-
|
|
161
|
-
map_back(child);
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
map_forward(a, 1);
|
|
166
|
-
map_forward(b, 2);
|
|
167
|
-
|
|
168
|
-
map_back(a);
|
|
169
|
-
map_back(b);
|
|
170
|
-
|
|
171
|
-
/**
|
|
172
|
-
*
|
|
173
|
-
* @type {Set<V>}
|
|
174
|
-
*/
|
|
175
|
-
const mappable_vertices = new Set();
|
|
176
|
-
|
|
177
|
-
// identify mapping between vertices
|
|
178
|
-
const edge_values = edge_set.values();
|
|
179
|
-
for (const edge_vertex_0 of edge_values) {
|
|
180
|
-
|
|
181
|
-
for (const edge_vertex_1 of edge_values) {
|
|
182
|
-
if (edge_vertex_0 === edge_vertex_1) {
|
|
183
|
-
// skip self
|
|
184
|
-
continue;
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
if ((edge_vertex_0.path & edge_vertex_1.path) !== 0) {
|
|
188
|
-
// belongs to both loops or the same loop. skip
|
|
189
|
-
continue;
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
const v0_index = edge_vertex_0.index;
|
|
193
|
-
const v1_index = edge_vertex_1.index;
|
|
194
|
-
|
|
195
|
-
if (edge_vertex_0.connects_to.has(edge_vertex_1)) {
|
|
196
|
-
// already connected, skip
|
|
197
|
-
continue;
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
const path = graph.findPath(v0_index, v1_index);
|
|
201
|
-
|
|
202
|
-
if (path === null) {
|
|
203
|
-
continue;
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
// record connection
|
|
207
|
-
edge_vertex_0.connects_to.add(edge_vertex_1);
|
|
208
|
-
edge_vertex_1.connects_to.add(edge_vertex_0);
|
|
209
|
-
|
|
210
|
-
mappable_vertices.add(edge_vertex_0);
|
|
211
|
-
mappable_vertices.add(edge_vertex_1);
|
|
212
|
-
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
while (true) {
|
|
216
|
-
let move_count = 0;
|
|
217
|
-
// attempt remapping
|
|
218
|
-
for (const v0 of mappable_vertices) {
|
|
219
|
-
// compute the cost of mapping this vertex forward
|
|
220
|
-
if (v0.connected) {
|
|
221
|
-
// already connected, skip
|
|
222
|
-
continue;
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
let best_option_cost = Number.POSITIVE_INFINITY;
|
|
226
|
-
let best_map_cost = Number.POSITIVE_INFINITY;
|
|
227
|
-
/**
|
|
228
|
-
* @type {V}
|
|
229
|
-
*/
|
|
230
|
-
let v_from;
|
|
231
|
-
/**
|
|
232
|
-
* @type {V}
|
|
233
|
-
*/
|
|
234
|
-
let v_to;
|
|
235
|
-
|
|
236
|
-
const forward_option_count = v0.connects_to.size;
|
|
237
|
-
|
|
238
|
-
if (forward_option_count === 0) {
|
|
239
|
-
// no forward options left
|
|
240
|
-
continue;
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
for (const v1 of v0.connects_to) {
|
|
244
|
-
|
|
245
|
-
if (vertex_map.get(v1.index) === undefined) {
|
|
246
|
-
// vertex is gone, most likely mapped somewhere else already
|
|
247
|
-
continue;
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
const backward_option_count = v1.connects_to.size;
|
|
251
|
-
|
|
252
|
-
const forward_option_cost = forward_option_count - backward_option_count;
|
|
253
|
-
|
|
254
|
-
if (best_option_cost >= forward_option_cost) {
|
|
255
|
-
|
|
256
|
-
const map_cost_forward = computeVertexMoveCost(v0, v1);
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
if (map_cost_forward < best_map_cost) {
|
|
260
|
-
v_from = v0;
|
|
261
|
-
v_to = v1;
|
|
262
|
-
best_map_cost = map_cost_forward;
|
|
263
|
-
best_option_cost = forward_option_cost;
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
if (
|
|
269
|
-
!v1.connected
|
|
270
|
-
&& best_option_cost >= -forward_option_cost
|
|
271
|
-
) {
|
|
272
|
-
const map_cost_backward = computeVertexMoveCost(v1, v0);
|
|
273
|
-
|
|
274
|
-
if (map_cost_backward < best_map_cost) {
|
|
275
|
-
v_from = v1;
|
|
276
|
-
v_to = v0;
|
|
277
|
-
best_map_cost = map_cost_backward;
|
|
278
|
-
best_option_cost = -forward_option_cost;
|
|
279
|
-
}
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
// execute op
|
|
285
|
-
const topo_v_from = vertex_map.get(v_from.index);
|
|
286
|
-
const topo_v_to = vertex_map.get(v_to.index);
|
|
287
|
-
|
|
288
|
-
topo_v_to.replaceAnotherVertex(topo_v_from);
|
|
289
|
-
|
|
290
|
-
mesh.removeVertex(topo_v_from);
|
|
291
|
-
// debugValidateMesh(mesh);
|
|
292
|
-
|
|
293
|
-
// erase from record
|
|
294
|
-
vertex_map.delete(v_from.index);
|
|
295
|
-
|
|
296
|
-
// mark moved vertex
|
|
297
|
-
// const v_from_rep = edge_set.get(v_from.index);
|
|
298
|
-
|
|
299
|
-
v_from.connected = true;
|
|
300
|
-
|
|
301
|
-
// patch neighbours of the removed vertex
|
|
302
|
-
v_to.connects_to.delete(v_from);
|
|
303
|
-
|
|
304
|
-
for (const v of v_from.connects_to) {
|
|
305
|
-
if (v !== v_to) {
|
|
306
|
-
v_to.connects_to.add(v);
|
|
307
|
-
v.connects_to.delete(v_from);
|
|
308
|
-
v.connects_to.add(v_to);
|
|
309
|
-
}
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
move_count++;
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
if (move_count === 0) {
|
|
316
|
-
break;
|
|
317
|
-
}
|
|
318
|
-
}
|
|
319
|
-
}
|
|
320
|
-
}
|