@woosh/meep-engine 2.48.19 → 2.48.21

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.
Files changed (117) hide show
  1. package/package.json +1 -1
  2. package/src/core/binary/type/BinaryDataType.d.ts +15 -0
  3. package/src/{engine/graphics/render/forward_plus/data/computeDataType.js → core/binary/type/computeBinaryDataTypeByPrecision.js} +3 -3
  4. package/src/core/geom/2d/quad-tree/qt_query_data_nearest_to_point.js +62 -0
  5. package/src/core/graph/layout/computeDisconnectedSubGraphs.js +1 -0
  6. package/src/core/process/task/TaskGroup.js +1 -1
  7. package/src/core/process/task/util/task_tree_compute_leaf_tasks.js +21 -0
  8. package/src/engine/graphics/geometry/AttributeSpec.d.ts +2 -2
  9. package/src/engine/graphics/material/optimization/MaterialOptimizationContext.js +1 -3
  10. package/src/engine/graphics/render/forward_plus/LightManager.js +9 -7
  11. package/src/engine/graphics/{micron/render/instanced → texture}/AttributeDataTexture.js +28 -19
  12. package/src/engine/graphics/{render/forward_plus/data → texture}/TextureBackedMemoryRegion.js +8 -8
  13. package/src/engine/graphics/{render/forward_plus/data → texture}/computeThreeTextureFormat.js +2 -2
  14. package/src/engine/graphics/{render/forward_plus/data → texture}/computeThreeTextureInternalFormatFromDataType.js +1 -1
  15. package/src/engine/graphics/{render/forward_plus/data → texture}/computeThreeTextureTypeFromDataType.js +1 -1
  16. package/src/engine/graphics/texture/sampler/Sampler2D2Canvas.js +1 -1
  17. package/src/engine/graphics/texture/sampler/sampler2DToFloat32Texture.js +1 -3
  18. package/src/generation/GridTaskGroup.js +4 -4
  19. package/src/generation/filtering/numeric/util/populateSampler2DFromCellFilter.js +10 -2
  20. package/src/generation/filtering/numeric/util/sampler_from_filter.js +26 -0
  21. package/src/generation/filtering/numeric/util/visualise_filters_as_grid.js +81 -0
  22. package/src/generation/grid/generation/GridTaskSequence.js +3 -1
  23. package/src/engine/graphics/micron/MICRON_GEOMETRY_FIELD.js +0 -1
  24. package/src/engine/graphics/micron/MICRON_URI_FIELD.js +0 -1
  25. package/src/engine/graphics/micron/build/MICRON_PATCH_SIZE_MAX.js +0 -5
  26. package/src/engine/graphics/micron/build/PatchRepresentation.js +0 -424
  27. package/src/engine/graphics/micron/build/buildMicronGeometryFromBufferGeometry.js +0 -311
  28. package/src/engine/graphics/micron/build/build_geometry_info.js +0 -21
  29. package/src/engine/graphics/micron/build/clustering/assignInitialPatchNeighbours.js +0 -63
  30. package/src/engine/graphics/micron/build/clustering/assign_patch_neighbours_from_topology.js +0 -46
  31. package/src/engine/graphics/micron/build/clustering/build_clustering_2.js +0 -37
  32. package/src/engine/graphics/micron/build/clustering/build_leaf_patches.js +0 -326
  33. package/src/engine/graphics/micron/build/clustering/build_leaf_patches_metis.js +0 -76
  34. package/src/engine/graphics/micron/build/clustering/computeBorderLengthChange.js +0 -59
  35. package/src/engine/graphics/micron/build/clustering/computeFaceCurvatureScore.js +0 -57
  36. package/src/engine/graphics/micron/build/clustering/computeOpenFaceFreedom.js +0 -35
  37. package/src/engine/graphics/micron/build/clustering/compute_face_connection_weight.js +0 -35
  38. package/src/engine/graphics/micron/build/clustering/populateOpenFaceNeighboursForPatch.js +0 -56
  39. package/src/engine/graphics/micron/build/clustering/validate_leaf_patch_connectivity.js +0 -44
  40. package/src/engine/graphics/micron/build/compute_micron_buffer_array_constructor.js +0 -24
  41. package/src/engine/graphics/micron/build/compute_vertex_remap_cost.js +0 -29
  42. package/src/engine/graphics/micron/build/debug/build_clustering_info.js +0 -58
  43. package/src/engine/graphics/micron/build/debug/build_graph_info.js +0 -59
  44. package/src/engine/graphics/micron/build/fill_patch_geometry_data.js +0 -270
  45. package/src/engine/graphics/micron/build/hierarchy/buildAbstractPatchHierarchy.js +0 -196
  46. package/src/engine/graphics/micron/build/hierarchy/build_intermediate_patch_topology.js +0 -162
  47. package/src/engine/graphics/micron/build/hierarchy/build_merge_graph.js +0 -89
  48. package/src/engine/graphics/micron/build/hierarchy/computePatchMergeScore.js +0 -146
  49. package/src/engine/graphics/micron/build/hierarchy/compute_patches_shared_vertex_count.js +0 -32
  50. package/src/engine/graphics/micron/build/hierarchy/compute_patches_shared_vertices.js +0 -34
  51. package/src/engine/graphics/micron/build/hierarchy/merge_patches.js +0 -581
  52. package/src/engine/graphics/micron/build/hierarchy/metis_cluster_clusters.js +0 -53
  53. package/src/engine/graphics/micron/build/hierarchy/optimize_graph_partitioning_balance.js +0 -515
  54. package/src/engine/graphics/micron/build/hierarchy/patch_combine.js +0 -180
  55. package/src/engine/graphics/micron/build/hierarchy/patch_fill_holes_by_uncollapse.js +0 -60
  56. package/src/engine/graphics/micron/build/hierarchy/patch_stitch_parent_border.js +0 -320
  57. package/src/engine/graphics/micron/build/hierarchy/qvdr_build_simplified_clusters.js +0 -547
  58. package/src/engine/graphics/micron/build/hierarchy/qvdr_build_tree.js +0 -140
  59. package/src/engine/graphics/micron/buildPatchwork.js +0 -68
  60. package/src/engine/graphics/micron/convert_three_object_to_micron.js +0 -179
  61. package/src/engine/graphics/micron/debug/VirtualGeometryStats.js +0 -42
  62. package/src/engine/graphics/micron/format/MICRON_GEOMETRY_PROPERTY_NAME.js +0 -1
  63. package/src/engine/graphics/micron/format/MicronGeometry.d.ts +0 -21
  64. package/src/engine/graphics/micron/format/MicronGeometry.js +0 -334
  65. package/src/engine/graphics/micron/format/MicronGeometryPatch.d.ts +0 -3
  66. package/src/engine/graphics/micron/format/MicronGeometryPatch.js +0 -205
  67. package/src/engine/graphics/micron/format/MicronGeometryPatchOccurance.js +0 -50
  68. package/src/engine/graphics/micron/format/ThreeMicronMesh.d.ts +0 -10
  69. package/src/engine/graphics/micron/format/ThreeMicronMesh.js +0 -45
  70. package/src/engine/graphics/micron/format/VirtualGeometry.js +0 -158
  71. package/src/engine/graphics/micron/format/micron_build_proxy_geometry.js +0 -205
  72. package/src/engine/graphics/micron/format/serialization/MicronGeometryBinarySerializationAdapter.js +0 -123
  73. package/src/engine/graphics/micron/format/serialization/MicronGeometryBinarySerializationAdapter.spec.js +0 -63
  74. package/src/engine/graphics/micron/format/serialization/collection/geometry_collection_serialization.js +0 -83
  75. package/src/engine/graphics/micron/format/serialization/collection/geometry_collection_serialization.spec.js +0 -51
  76. package/src/engine/graphics/micron/format/serialization/deserialize_attribute_spec.js +0 -25
  77. package/src/engine/graphics/micron/format/serialization/deserialize_patch.js +0 -106
  78. package/src/engine/graphics/micron/format/serialization/serialize_attribute_spec.js +0 -18
  79. package/src/engine/graphics/micron/format/serialization/serialize_patch.js +0 -84
  80. package/src/engine/graphics/micron/format/validate_patch_bounds.js +0 -69
  81. package/src/engine/graphics/micron/plugin/GLTFAssetTransformer.js +0 -265
  82. package/src/engine/graphics/micron/plugin/GLTF_MICRON_ID_FIELD.js +0 -5
  83. package/src/engine/graphics/micron/plugin/MicronRenderPlugin.d.ts +0 -8
  84. package/src/engine/graphics/micron/plugin/MicronRenderPlugin.js +0 -150
  85. package/src/engine/graphics/micron/plugin/serialization/BufferGeometrySerializationAdapter.js +0 -176
  86. package/src/engine/graphics/micron/plugin/shaded_geometry/MicronShadedGeometryRenderAdapter.js +0 -216
  87. package/src/engine/graphics/micron/prototypeMicronProxyBuild.js +0 -227
  88. package/src/engine/graphics/micron/prototypeVirtualGeometry.js +0 -911
  89. package/src/engine/graphics/micron/render/PatchCacheKey.js +0 -79
  90. package/src/engine/graphics/micron/render/VIRTUAL_MESH_FLAG.d.ts +0 -1
  91. package/src/engine/graphics/micron/render/VIRTUAL_MESH_FLAG.js +0 -1
  92. package/src/engine/graphics/micron/render/VirtualGeometryBuilder.js +0 -207
  93. package/src/engine/graphics/micron/render/approximateTriangleArea.js +0 -25
  94. package/src/engine/graphics/micron/render/culling/PatchCullingSystem.js +0 -129
  95. package/src/engine/graphics/micron/render/instanced/PatchDataTextures.js +0 -325
  96. package/src/engine/graphics/micron/render/instanced/ThreeInstancedAdapter.js +0 -175
  97. package/src/engine/graphics/micron/render/instanced/shader/constants.js +0 -3
  98. package/src/engine/graphics/micron/render/instanced/shader/gen_micron_vertex_attribute_texture_name.js +0 -8
  99. package/src/engine/graphics/micron/render/instanced/shader/shader_rewrite_standard.js +0 -250
  100. package/src/engine/graphics/micron/render/makeThreeMeshFromVirtualGeometry.js +0 -37
  101. package/src/engine/graphics/micron/render/refinement/ActivePatchFlags.js +0 -8
  102. package/src/engine/graphics/micron/render/refinement/ActivePatchList.js +0 -241
  103. package/src/engine/graphics/micron/render/refinement/ActivePatchRecord.js +0 -154
  104. package/src/engine/graphics/micron/render/refinement/RefinementSpec.js +0 -84
  105. package/src/engine/graphics/micron/render/refinement/get_geometry_patch_cut.js +0 -133
  106. package/src/engine/graphics/micron/render/refinement/is_patch_facing_back.js +0 -43
  107. package/src/engine/graphics/micron/render/refinement/is_patch_visible.js +0 -37
  108. package/src/engine/graphics/micron/render/v1/MaterialContext.js +0 -150
  109. package/src/engine/graphics/micron/render/v1/MaterialVertexSpec.js +0 -115
  110. package/src/engine/graphics/micron/render/v1/MicronRenderContext.js +0 -145
  111. package/src/engine/graphics/micron/render/v1/ThreeVirtualGeometryAdapter.js +0 -255
  112. package/src/engine/graphics/micron/render/v1/VGThreeRenderer.js +0 -142
  113. package/src/engine/graphics/micron/render/v1/getTransformedPositionsCached.js +0 -54
  114. package/src/engine/graphics/micron/simplifyGeometry.js +0 -26
  115. package/src/engine/graphics/micron/util/patchToBufferGeometry.js +0 -19
  116. /package/src/{engine/graphics/render/forward_plus/data → core/math}/NumericType.js +0 -0
  117. /package/src/engine/graphics/{render/forward_plus/data → texture}/channelCountToThreIntegerTextureType.js +0 -0
@@ -1,162 +0,0 @@
1
- import { simplifyTopoMesh } from "../../../../../core/geom/3d/topology/simplify/simplifyTopoMesh.js";
2
- import { MICRON_PATCH_SIZE_MAX } from "../MICRON_PATCH_SIZE_MAX.js";
3
-
4
-
5
- /**
6
- *
7
- * @param {Set<number>} result
8
- * @param {TopoMesh} topology
9
- * @param {PatchRepresentation[]} cluster_nodes
10
- */
11
- export function compute_set_of_shared_vertices(result, topology, cluster_nodes) {
12
- // build outer neighbour set
13
-
14
- /**
15
- *
16
- * @type {Set<PatchRepresentation>}
17
- */
18
- const outer_neighbours = new Set();
19
-
20
- const cluster_node_count = cluster_nodes.length;
21
- for (let i = 0; i < cluster_node_count; i++) {
22
- const node = cluster_nodes[i];
23
-
24
- const node_neighbours = node.neighbours;
25
- const node_neighbour_count = node_neighbours.length;
26
- for (let j = 0; j < node_neighbour_count; j++) {
27
- const neighbour = node_neighbours[j];
28
-
29
- if (cluster_nodes.indexOf(neighbour) !== -1) {
30
- // not an outer neighbour
31
- continue;
32
- }
33
-
34
- outer_neighbours.add(neighbour);
35
- }
36
- }
37
-
38
- // ingest topology vertices into a set for quick access
39
- const topo_vertices = new Set();
40
- const vertices = topology.vertices;
41
- const topo_vertex_count = vertices.length;
42
- for (let i = 0; i < topo_vertex_count; i++) {
43
- const vertex = vertices[i];
44
-
45
- topo_vertices.add(vertex.index);
46
- }
47
-
48
- // identify border vertices
49
- for (const outerNeighbour of outer_neighbours) {
50
- const neighbour_topo = outerNeighbour.topology_snapshot;
51
-
52
- const n_vx = neighbour_topo.vertices;
53
- const n_vx_count = n_vx.length;
54
-
55
- for (let i = 0; i < n_vx_count; i++) {
56
- const v = n_vx[i];
57
-
58
- const vi = v.index;
59
-
60
- if (topo_vertices.has(vi)) {
61
- result.add(vi);
62
- }
63
- }
64
- }
65
- }
66
-
67
- /**
68
- *
69
- * @param {Set<number>} result
70
- * @param {TopoMesh} topology
71
- */
72
- export function compute_set_of_border_vertex_indices(result, topology) {
73
- const edges = topology.getEdges();
74
-
75
- for (let edge of edges) {
76
- const faces = edge.faces;
77
- let included_face_count = 0;
78
-
79
- if (!edge.isLinked()) {
80
- // edge was removed
81
- continue;
82
- }
83
-
84
- const face_count = faces.length;
85
- for (let i = 0; i < face_count; i++) {
86
- const face = faces[i];
87
-
88
- if (topology.containsFace(face)) {
89
- included_face_count++;
90
- }
91
- }
92
-
93
- if (included_face_count <= 1) {
94
- const v0 = edge.v0;
95
- result.add(v0.index);
96
-
97
- const v1 = edge.v1;
98
- result.add(v1.index);
99
- //
100
- // if (!topology.containsVertex(v0) || !topology.containsVertex(v1)) {
101
- //
102
- // console.log(edge);
103
- // debugger;
104
- // }
105
- }
106
- }
107
- }
108
-
109
- /**
110
- *
111
- * @param {TopoMesh} result
112
- * @param {TopoMesh} a
113
- * @param {TopoMesh} b
114
- */
115
- export function compute_merged_topology(result, a, b) {
116
-
117
- /**
118
- *
119
- * @type {Map<number, TopoVertex>}
120
- */
121
- const vertex_index_map = new Map();
122
-
123
-
124
- // accumulate topology
125
- result._addWithVertexMap(a, vertex_index_map);
126
- result._addWithVertexMap(b, vertex_index_map);
127
- }
128
-
129
- /**
130
- *
131
- * @param {PatchRepresentation} patch
132
- */
133
- export function build_intermediate_patch_topology(patch) {
134
- // figure out if patches are connected
135
- const a = patch.children[0];
136
- const b = patch.children[1];
137
-
138
- // const children_connected = a.hasNeighbour(b);
139
-
140
- compute_merged_topology(patch.topology_mask, a.topology_mask, b.topology_mask);
141
-
142
- // r.traverse(p =>{
143
- // if(p.lod === 0){
144
- // r.topology._addWithVertexMap(p.topology,vertex_index_map);
145
- // }
146
- // });
147
-
148
- const restricted_vertices = new Set();
149
-
150
- compute_set_of_border_vertex_indices(restricted_vertices, patch.topology_mask);
151
-
152
- // remove discontinuities. move vertices in A to match B
153
- // apply_collapsed_edges(b.simplified_points, r.topology);
154
-
155
- // debugValidateMesh(r.topology);
156
-
157
- simplifyTopoMesh(patch.topology_mask, MICRON_PATCH_SIZE_MAX, restricted_vertices);
158
-
159
- // build mapping for simplified points
160
- // build_vertex_mapping_from_simplification(patch.simplified_points, patch.reverse_simplified_points, patch.collapsed_edges);
161
-
162
- }
@@ -1,89 +0,0 @@
1
- import { Graph } from "../../../../../core/graph/v2/Graph.js";
2
- import { MultiNode } from "../../../../../core/graph/MultiNode.js";
3
- import { computePatchMergeScore } from "./computePatchMergeScore.js";
4
- import { WeightedEdge } from "../../../../../core/graph/WeightedEdge.js";
5
- import { assert } from "../../../../../core/assert.js";
6
-
7
- /**
8
- *
9
- * @param {PatchRepresentation[]} leaves
10
- * @returns {Graph<MultiNode<PatchRepresentation>>}
11
- */
12
- export function build_merge_graph(leaves) {
13
- /**
14
- *
15
- * @type {Graph<MultiNode<PatchRepresentation>>}
16
- */
17
- const graph = new Graph();
18
-
19
- /**
20
- *
21
- * @type {Map<PatchRepresentation, MultiNode<PatchRepresentation>>}
22
- */
23
- const leaf_to_node_map = new Map();
24
-
25
- // add nodes
26
- const leaf_count = leaves.length;
27
- for (let i = 0; i < leaf_count; i++) {
28
- const leaf = leaves[i];
29
-
30
- const node = MultiNode.fromOne(leaf);
31
-
32
- graph.addNode(node);
33
-
34
- leaf_to_node_map.set(leaf, node);
35
- }
36
-
37
- // create edges
38
- for (let i = 0; i < leaf_count; i++) {
39
- const leaf = leaves[i];
40
-
41
- const neighbours = leaf.neighbours;
42
- const neighbour_count = neighbours.length;
43
-
44
- const node_leaf = leaf_to_node_map.get(leaf);
45
-
46
- const node_container_leaf = graph.getNodeContainer(node_leaf);
47
-
48
- const connected_edges = node_container_leaf.getEdges();
49
-
50
- if (neighbour_count === 0 && connected_edges.length === 0) {
51
- // no neighbours and not otherwise connected in the graph
52
- // TODO address
53
- // throw new Error('Disconnected node');
54
- continue;
55
- }
56
-
57
- for (let j = 0; j < neighbour_count; j++) {
58
- const neighbour = neighbours[j];
59
-
60
- const node_neighbour = leaf_to_node_map.get(neighbour);
61
-
62
- if (node_neighbour === undefined) {
63
- // not in the input set
64
- continue;
65
- }
66
-
67
- const existing_edge = node_container_leaf.getAnyEdgeWith(node_neighbour);
68
-
69
- if (existing_edge !== undefined) {
70
- // edge already exists
71
- continue;
72
- }
73
-
74
- const connection_weight = computePatchMergeScore(leaf, neighbour);
75
-
76
- assert.isNumber(connection_weight, 'connection_weight');
77
- assert.notNaN(connection_weight, 'connection_weight');
78
- assert.isFiniteNumber(connection_weight, 'connection_weight');
79
-
80
- const edge = new WeightedEdge(node_leaf, node_neighbour);
81
-
82
- edge.weight = connection_weight;
83
-
84
- graph.addEdge(edge);
85
- }
86
- }
87
-
88
- return graph;
89
- }
@@ -1,146 +0,0 @@
1
- import { ConicRay } from "../../../../../core/geom/ConicRay.js";
2
- import { compute_bounding_cone_of_2_cones } from "../../../../../core/geom/3d/cone/compute_bounding_cone_of_2_cones.js";
3
- import { compute_patches_shared_vertex_count } from "./compute_patches_shared_vertex_count.js";
4
- import {
5
- compute_bounding_sphere_of_2_spheres
6
- } from "../../../../../core/geom/3d/compute_bounding_sphere_of_2_spheres.js";
7
- import { max2 } from "../../../../../core/math/max2.js";
8
- import { min2 } from "../../../../../core/math/min2.js";
9
- import { assert } from "../../../../../core/assert.js";
10
-
11
-
12
- /**
13
- * Assumes that neither array contains duplicated in it's own scope
14
- * @template T
15
- * @param {T[]} array_a
16
- * @param {T[]} array_b
17
- * @returns {number}
18
- */
19
- function array_compute_common_element_count(array_a, array_b) {
20
-
21
- let result = 0;
22
-
23
- const a_count = array_a.length;
24
-
25
- for (let i = 0; i < a_count; i++) {
26
- const a = array_a[i];
27
-
28
- if (array_b.indexOf(a) !== -1) {
29
- result++;
30
- }
31
- }
32
-
33
- return result;
34
- }
35
-
36
- const scratch_cone = new ConicRay();
37
-
38
- /**
39
- *
40
- * @type {number[]}
41
- */
42
- const scratch_v4 = [];
43
-
44
- /**
45
- *
46
- * @param {ConicRay} a
47
- * @param {ConicRay} b
48
- * @returns {number}
49
- */
50
- function coneMergeCost_2(a, b) {
51
- compute_bounding_cone_of_2_cones(scratch_cone, a, b);
52
-
53
- return scratch_cone.angle;
54
- }
55
-
56
- /**
57
- * pi^2
58
- * @type {number}
59
- */
60
- const pi_sqr = 9.86960440109;
61
-
62
- /**
63
- *
64
- * @param {number} r radius
65
- * @return {number}
66
- */
67
- function compute_sphere_volume(r) {
68
- const r3 = r * r * r;
69
-
70
- return r3 * 4.18879020479;
71
- }
72
-
73
- /**
74
- *
75
- * @param {number} a
76
- * @param {number} b
77
- * @return {number}
78
- */
79
- function normalized_difference(a, b) {
80
- assert.isNumber(a, 'a');
81
- assert.isNumber(b, 'a');
82
-
83
- assert.notNaN(a,'a');
84
- assert.notNaN(b,'b');
85
-
86
- return Math.abs(a - b) / (max2(a, b) + 0.0001);
87
- }
88
-
89
- /**
90
- *
91
- * @param {PatchRepresentation} a
92
- * @param {PatchRepresentation} b
93
- * @returns {number} higher score means better fitness
94
- */
95
- export function computePatchMergeScore(a, b) {
96
- // compute common neighbours
97
- const a_neighbours = a.neighbours;
98
- const b_neighbours = b.neighbours;
99
-
100
- const common_neighbours = array_compute_common_element_count(a_neighbours, b_neighbours);
101
-
102
- // normalize neighbour count
103
- const common_neighbour_score = common_neighbours / (min2(a_neighbours.length, b_neighbours.length) + 0.01);
104
-
105
- // prefer merging patches of similar LOD level, this creates a more flat hierarchy
106
- const lod_score = 1 - normalized_difference(a.lod, b.lod);
107
-
108
- const merged_cone_angle = coneMergeCost_2(a.normal_cone, b.normal_cone);
109
- /**
110
- * Try to merge patches that have similar normals, that is they face in the same direction
111
- * @type {number}
112
- */
113
- const normal_score = 1 - (merged_cone_angle * merged_cone_angle) / pi_sqr;
114
-
115
- /*
116
- prefer cluster of similar volume
117
- */
118
- const a_bounds_radius = a.bounding_sphere[3];
119
- const b_bounds_radius = b.bounding_sphere[3];
120
-
121
- const similar_volume_score = 1 - normalized_difference(a_bounds_radius, b_bounds_radius);
122
- /*
123
- prefer merging patches that have similar bounds, this ensures good spatial locality
124
- */
125
- compute_bounding_sphere_of_2_spheres(scratch_v4, a.bounding_sphere, b.bounding_sphere);
126
-
127
- const merged_sphere_volume = compute_sphere_volume(scratch_v4[3]);
128
-
129
- const summed_sphere_volume = compute_sphere_volume(a_bounds_radius) + compute_sphere_volume(b_bounds_radius)
130
-
131
- const volume_score = summed_sphere_volume / (merged_sphere_volume + 0.01);
132
-
133
- /*
134
- Prefer patches that share more vertices
135
- */
136
- const shared_vertex_count = compute_patches_shared_vertex_count(a, b);
137
-
138
- const result = similar_volume_score * 0.01
139
- + shared_vertex_count
140
- + normal_score * 0.001
141
- + common_neighbour_score
142
- + lod_score * 0.1
143
- + volume_score;
144
-
145
- return result;
146
- }
@@ -1,32 +0,0 @@
1
- /**
2
- *
3
- * @param {PatchRepresentation} a
4
- * @param {PatchRepresentation} b
5
- * @returns {number}
6
- */
7
- export function compute_patches_shared_vertex_count(a, b) {
8
- let result = 0;
9
-
10
- const seen_vertices = new Set();
11
-
12
- const a_vertices = a.topology_snapshot.vertices;
13
- const a_vertex_count = a_vertices.length;
14
- for (let i = 0; i < a_vertex_count; i++) {
15
- const v = a_vertices[i];
16
-
17
- seen_vertices.add(v.index);
18
- }
19
-
20
-
21
- const b_vertices = b.topology_snapshot.vertices;
22
- const b_vertex_count = b_vertices.length;
23
- for (let i = 0; i < b_vertex_count; i++) {
24
- const v = b_vertices[i];
25
-
26
- if (seen_vertices.has(v.index)) {
27
- result++;
28
- }
29
- }
30
-
31
- return result;
32
- }
@@ -1,34 +0,0 @@
1
- /**
2
- *
3
- * @param {PatchRepresentation} a
4
- * @param {PatchRepresentation} b
5
- * @returns {Set<number>}
6
- */
7
- export function compute_patches_shared_vertices(a, b) {
8
- const seen = new Set();
9
- const result = new Set();
10
-
11
- const a_vertices = a.topology_mask.vertices;
12
-
13
- const a_vertex_count = a_vertices.length;
14
-
15
- for (let i = 0; i < a_vertex_count; i++) {
16
- const v = a_vertices[i];
17
-
18
- seen.add(v.index);
19
- }
20
-
21
-
22
- const b_vertices = b.topology_mask.vertices;
23
- const b_vertex_count = b_vertices.length;
24
- for (let i = 0; i < b_vertex_count; i++) {
25
- const v = b_vertices[i];
26
- const v_index = v.index;
27
- if (seen.add(v_index)) {
28
- result.add(v_index);
29
- }
30
- }
31
-
32
-
33
- return result;
34
- }