@manycore/aholo-splat-transform 1.2.8 → 1.2.9

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 (97) hide show
  1. package/CHANGELOG.md +120 -113
  2. package/README.md +39 -39
  3. package/THIRD_PARTY_LICENSES.txt +1373 -1373
  4. package/bin/cli.js +125 -118
  5. package/dist/SplatData.d.ts +67 -67
  6. package/dist/SplatData.js +167 -150
  7. package/dist/constant.d.ts +3 -3
  8. package/dist/constant.js +13 -13
  9. package/dist/file/IFile.d.ts +5 -5
  10. package/dist/file/IFile.js +1 -1
  11. package/dist/file/esz.d.ts +11 -11
  12. package/dist/file/esz.js +337 -322
  13. package/dist/file/index.d.ts +8 -8
  14. package/dist/file/index.js +7 -7
  15. package/dist/file/ksplat.d.ts +12 -12
  16. package/dist/file/ksplat.js +293 -231
  17. package/dist/file/lcc.d.ts +11 -11
  18. package/dist/file/lcc.js +161 -158
  19. package/dist/file/ply.d.ts +13 -13
  20. package/dist/file/ply.js +439 -390
  21. package/dist/file/sog.d.ts +80 -80
  22. package/dist/file/sog.js +525 -494
  23. package/dist/file/splat.d.ts +6 -6
  24. package/dist/file/splat.js +119 -99
  25. package/dist/file/spz.d.ts +11 -11
  26. package/dist/file/spz.js +597 -583
  27. package/dist/file/voxel.d.ts +43 -37
  28. package/dist/file/voxel.js +411 -280
  29. package/dist/index.d.ts +33 -33
  30. package/dist/index.js +54 -54
  31. package/dist/native/index.d.ts +54 -54
  32. package/dist/native/index.js +122 -129
  33. package/dist/native/utils.d.ts +1 -0
  34. package/dist/native/utils.js +54 -0
  35. package/dist/tasks/AutoChunkLodTask.d.ts +13 -13
  36. package/dist/tasks/AutoChunkLodTask.js +117 -117
  37. package/dist/tasks/AutoLodTask.d.ts +10 -10
  38. package/dist/tasks/AutoLodTask.js +20 -20
  39. package/dist/tasks/BaseTask.d.ts +15 -15
  40. package/dist/tasks/BaseTask.js +5 -5
  41. package/dist/tasks/FlexLodTask.d.ts +12 -12
  42. package/dist/tasks/FlexLodTask.js +54 -44
  43. package/dist/tasks/ModifyTask.d.ts +9 -9
  44. package/dist/tasks/ModifyTask.js +166 -156
  45. package/dist/tasks/ReadTask.d.ts +9 -9
  46. package/dist/tasks/ReadTask.js +29 -29
  47. package/dist/tasks/SkeletonLodTask.d.ts +10 -10
  48. package/dist/tasks/SkeletonLodTask.js +176 -156
  49. package/dist/tasks/VoxelTask.d.ts +35 -30
  50. package/dist/tasks/VoxelTask.js +40 -37
  51. package/dist/tasks/WriteTask.d.ts +12 -12
  52. package/dist/tasks/WriteTask.js +70 -70
  53. package/dist/utils/BufferReader.d.ts +12 -12
  54. package/dist/utils/BufferReader.js +45 -45
  55. package/dist/utils/Logger.d.ts +11 -11
  56. package/dist/utils/Logger.js +40 -40
  57. package/dist/utils/StreamChunkDecoder.d.ts +16 -16
  58. package/dist/utils/StreamChunkDecoder.js +31 -31
  59. package/dist/utils/index.d.ts +27 -27
  60. package/dist/utils/index.js +101 -101
  61. package/dist/utils/k-means.d.ts +4 -4
  62. package/dist/utils/k-means.js +340 -341
  63. package/dist/utils/math.d.ts +46 -46
  64. package/dist/utils/math.js +350 -346
  65. package/dist/utils/quantize-1d.d.ts +4 -4
  66. package/dist/utils/quantize-1d.js +164 -164
  67. package/dist/utils/sh-rotate.d.ts +2 -2
  68. package/dist/utils/sh-rotate.js +236 -175
  69. package/dist/utils/splat.d.ts +21 -21
  70. package/dist/utils/splat.js +397 -387
  71. package/dist/utils/voxel/binary.d.ts +8 -0
  72. package/dist/utils/voxel/binary.js +176 -0
  73. package/dist/utils/voxel/common.d.ts +178 -162
  74. package/dist/utils/voxel/common.js +1752 -1682
  75. package/dist/utils/voxel/coplanar-merge.d.ts +63 -63
  76. package/dist/utils/voxel/coplanar-merge.js +818 -819
  77. package/dist/utils/voxel/filter-cluster.d.ts +20 -0
  78. package/dist/utils/voxel/filter-cluster.js +628 -0
  79. package/dist/utils/voxel/gpu-dilation.d.ts +2 -2
  80. package/dist/utils/voxel/gpu-dilation.js +677 -656
  81. package/dist/utils/voxel/marching-cubes.d.ts +42 -42
  82. package/dist/utils/voxel/marching-cubes.js +1645 -1657
  83. package/dist/utils/voxel/mesh.d.ts +3 -3
  84. package/dist/utils/voxel/mesh.js +130 -130
  85. package/dist/utils/voxel/nav.d.ts +29 -29
  86. package/dist/utils/voxel/nav.js +1068 -1043
  87. package/dist/utils/voxel/postprocess.d.ts +23 -23
  88. package/dist/utils/voxel/postprocess.js +408 -375
  89. package/dist/utils/voxel/voxel-faces.d.ts +18 -18
  90. package/dist/utils/voxel/voxel-faces.js +662 -663
  91. package/dist/utils/voxel/voxelize.d.ts +34 -33
  92. package/dist/utils/voxel/voxelize.js +1208 -1193
  93. package/dist/utils/webgpu.d.ts +8 -8
  94. package/dist/utils/webgpu.js +122 -122
  95. package/package.json +37 -39
  96. package/dist/native/cpp/bin/linux/binding.node +0 -0
  97. package/dist/native/cpp/bin/windows/binding.node +0 -0
@@ -1,63 +1,63 @@
1
- import type { Mesh } from './marching-cubes.js';
2
- /**
3
- * Losslessly reduce coplanar regions of a marching-cubes mesh by
4
- * topology-preserving vertex removal.
5
- *
6
- * For a closed manifold MC mesh, a vertex `v` is "lossless-removable" iff
7
- * its incident-tri fan, walked in cyclic order, falls into one of:
8
- *
9
- * 1. K=1 coplanar fan. Every triangle in v's fan lies on the same plane
10
- * (same unit normal and same plane offset, within tolerance). Removing
11
- * v is the inverse of vertex split: re-triangulate the boundary
12
- * polygon in the same plane.
13
- *
14
- * 2. K=2 collinear seam. The fan splits into exactly two contiguous
15
- * coplanar arcs (different planes). The two crease vertices `a` and
16
- * `b` (the boundary points where the plane changes around v) are
17
- * collinear with v in 3D, with v between them. Removing v collapses
18
- * the two crease edges (v-a, v-b) into a single straight edge (a-b)
19
- * that lies in both planes; each arc's polygon re-triangulates
20
- * without v.
21
- *
22
- * Vertices with K >= 3 (multi-way corners) are kept.
23
- *
24
- * Removing a removable v is exact-lossless: the surface footprint is
25
- * identical, no vertex moves and none are created. The transformation
26
- * is the inverse of vertex split, so it is topology-preserving by
27
- * construction:
28
- *
29
- * - No T-junctions. Every old vertex on the polygon boundary remains a
30
- * vertex of every triangle that previously touched it. Adjacent fused
31
- * regions and verbatim regions stay coupled at every shared vertex.
32
- * - Watertight. The closed manifold structure is preserved across
33
- * removal. Both the K=1 and K=2 cases preserve the K=2 seam edge as
34
- * a single shared edge between the two plane groups.
35
- * - Bit-exact. Every output position is a verbatim copy of an input
36
- * position; no vertex is fabricated.
37
- *
38
- * Algorithm:
39
- *
40
- * 1. Build per-vertex incident-tri lists and per-tri normalized normals
41
- * and plane offsets.
42
- * 2. Process vertices via a dirty-flag worklist. Initially queue every
43
- * vertex; after a successful removal, re-queue the ring neighbours
44
- * so chains of K=1 / K=2 vertices collapse in one run.
45
- * 3. For each dequeued vertex `v`:
46
- * a. Walk the fan to extract the cyclic ring vertices and the
47
- * cyclic ordered tris (each tri (v, ring[i], ring[(i+1)%k]) is
48
- * the i-th tri in fan order).
49
- * b. Decide K. If all tris share a plane: K=1. Otherwise count
50
- * transitions in cyclic order; K=2 if exactly two arcs.
51
- * c. K>=3: skip. K=2: verify ring[i1], v, ring[i2] are collinear.
52
- * d. For each arc, project its polygon to 2D using the arc's
53
- * plane basis, ear-clip, and append the new tris.
54
- * e. Mark v's old tris dead, register the new tris in each polygon
55
- * vertex's incident list, and re-queue the ring.
56
- * 4. Compact: drop dead tris and unused vertices, remap indices.
57
- *
58
- * @param mesh - Input triangle mesh from {@link marchingCubes}.
59
- * @param voxelResolution - Size of one voxel in world units. Used to scale the plane-offset tolerance. (The K=2 collinearity check is purely angular and has no voxel-scaled term.)
60
- * @returns A new mesh with the same surface geometry, no T-junctions, and far fewer triangles.
61
- */
62
- declare const coplanarMerge: (mesh: Mesh, voxelResolution: number) => Mesh;
63
- export { coplanarMerge };
1
+ import type { Mesh } from './marching-cubes.js';
2
+ /**
3
+ * Losslessly reduce coplanar regions of a marching-cubes mesh by
4
+ * topology-preserving vertex removal.
5
+ *
6
+ * For a closed manifold MC mesh, a vertex `v` is "lossless-removable" iff
7
+ * its incident-tri fan, walked in cyclic order, falls into one of:
8
+ *
9
+ * 1. K=1 coplanar fan. Every triangle in v's fan lies on the same plane
10
+ * (same unit normal and same plane offset, within tolerance). Removing
11
+ * v is the inverse of vertex split: re-triangulate the boundary
12
+ * polygon in the same plane.
13
+ *
14
+ * 2. K=2 collinear seam. The fan splits into exactly two contiguous
15
+ * coplanar arcs (different planes). The two crease vertices `a` and
16
+ * `b` (the boundary points where the plane changes around v) are
17
+ * collinear with v in 3D, with v between them. Removing v collapses
18
+ * the two crease edges (v-a, v-b) into a single straight edge (a-b)
19
+ * that lies in both planes; each arc's polygon re-triangulates
20
+ * without v.
21
+ *
22
+ * Vertices with K >= 3 (multi-way corners) are kept.
23
+ *
24
+ * Removing a removable v is exact-lossless: the surface footprint is
25
+ * identical, no vertex moves and none are created. The transformation
26
+ * is the inverse of vertex split, so it is topology-preserving by
27
+ * construction:
28
+ *
29
+ * - No T-junctions. Every old vertex on the polygon boundary remains a
30
+ * vertex of every triangle that previously touched it. Adjacent fused
31
+ * regions and verbatim regions stay coupled at every shared vertex.
32
+ * - Watertight. The closed manifold structure is preserved across
33
+ * removal. Both the K=1 and K=2 cases preserve the K=2 seam edge as
34
+ * a single shared edge between the two plane groups.
35
+ * - Bit-exact. Every output position is a verbatim copy of an input
36
+ * position; no vertex is fabricated.
37
+ *
38
+ * Algorithm:
39
+ *
40
+ * 1. Build per-vertex incident-tri lists and per-tri normalized normals
41
+ * and plane offsets.
42
+ * 2. Process vertices via a dirty-flag worklist. Initially queue every
43
+ * vertex; after a successful removal, re-queue the ring neighbours
44
+ * so chains of K=1 / K=2 vertices collapse in one run.
45
+ * 3. For each dequeued vertex `v`:
46
+ * a. Walk the fan to extract the cyclic ring vertices and the
47
+ * cyclic ordered tris (each tri (v, ring[i], ring[(i+1)%k]) is
48
+ * the i-th tri in fan order).
49
+ * b. Decide K. If all tris share a plane: K=1. Otherwise count
50
+ * transitions in cyclic order; K=2 if exactly two arcs.
51
+ * c. K>=3: skip. K=2: verify ring[i1], v, ring[i2] are collinear.
52
+ * d. For each arc, project its polygon to 2D using the arc's
53
+ * plane basis, ear-clip, and append the new tris.
54
+ * e. Mark v's old tris dead, register the new tris in each polygon
55
+ * vertex's incident list, and re-queue the ring.
56
+ * 4. Compact: drop dead tris and unused vertices, remap indices.
57
+ *
58
+ * @param mesh - Input triangle mesh from {@link marchingCubes}.
59
+ * @param voxelResolution - Size of one voxel in world units. Used to scale the plane-offset tolerance. (The K=2 collinearity check is purely angular and has no voxel-scaled term.)
60
+ * @returns A new mesh with the same surface geometry, no T-junctions, and far fewer triangles.
61
+ */
62
+ declare function coplanarMerge(mesh: Mesh, voxelResolution: number): Mesh;
63
+ export { coplanarMerge };