@manycore/aholo-splat-transform 1.2.7 → 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 (98) hide show
  1. package/CHANGELOG.md +120 -106
  2. package/COPYRIGHT.md +17 -0
  3. package/README.md +39 -39
  4. package/THIRD_PARTY_LICENSES.txt +1373 -0
  5. package/bin/cli.js +125 -118
  6. package/dist/SplatData.d.ts +67 -67
  7. package/dist/SplatData.js +167 -156
  8. package/dist/constant.d.ts +3 -3
  9. package/dist/constant.js +13 -13
  10. package/dist/file/IFile.d.ts +5 -5
  11. package/dist/file/IFile.js +1 -1
  12. package/dist/file/esz.d.ts +11 -0
  13. package/dist/file/esz.js +337 -0
  14. package/dist/file/index.d.ts +8 -7
  15. package/dist/file/index.js +7 -6
  16. package/dist/file/ksplat.d.ts +12 -12
  17. package/dist/file/ksplat.js +293 -232
  18. package/dist/file/lcc.d.ts +11 -11
  19. package/dist/file/lcc.js +161 -157
  20. package/dist/file/ply.d.ts +13 -13
  21. package/dist/file/ply.js +439 -388
  22. package/dist/file/sog.d.ts +80 -80
  23. package/dist/file/sog.js +525 -504
  24. package/dist/file/splat.d.ts +6 -6
  25. package/dist/file/splat.js +119 -99
  26. package/dist/file/spz.d.ts +11 -8
  27. package/dist/file/spz.js +597 -400
  28. package/dist/file/voxel.d.ts +43 -37
  29. package/dist/file/voxel.js +411 -280
  30. package/dist/index.d.ts +33 -33
  31. package/dist/index.js +54 -54
  32. package/dist/native/index.d.ts +54 -54
  33. package/dist/native/index.js +122 -128
  34. package/dist/native/utils.d.ts +1 -0
  35. package/dist/native/utils.js +54 -0
  36. package/dist/tasks/AutoChunkLodTask.d.ts +13 -13
  37. package/dist/tasks/AutoChunkLodTask.js +117 -117
  38. package/dist/tasks/AutoLodTask.d.ts +10 -10
  39. package/dist/tasks/AutoLodTask.js +20 -20
  40. package/dist/tasks/BaseTask.d.ts +15 -15
  41. package/dist/tasks/BaseTask.js +5 -5
  42. package/dist/tasks/FlexLodTask.d.ts +12 -12
  43. package/dist/tasks/FlexLodTask.js +54 -44
  44. package/dist/tasks/ModifyTask.d.ts +9 -9
  45. package/dist/tasks/ModifyTask.js +166 -156
  46. package/dist/tasks/ReadTask.d.ts +9 -9
  47. package/dist/tasks/ReadTask.js +29 -29
  48. package/dist/tasks/SkeletonLodTask.d.ts +10 -10
  49. package/dist/tasks/SkeletonLodTask.js +176 -156
  50. package/dist/tasks/VoxelTask.d.ts +35 -30
  51. package/dist/tasks/VoxelTask.js +40 -37
  52. package/dist/tasks/WriteTask.d.ts +12 -11
  53. package/dist/tasks/WriteTask.js +70 -70
  54. package/dist/utils/BufferReader.d.ts +12 -12
  55. package/dist/utils/BufferReader.js +45 -47
  56. package/dist/utils/Logger.d.ts +11 -11
  57. package/dist/utils/Logger.js +40 -38
  58. package/dist/utils/StreamChunkDecoder.d.ts +16 -16
  59. package/dist/utils/StreamChunkDecoder.js +31 -36
  60. package/dist/utils/index.d.ts +27 -27
  61. package/dist/utils/index.js +101 -101
  62. package/dist/utils/k-means.d.ts +4 -4
  63. package/dist/utils/k-means.js +340 -350
  64. package/dist/utils/math.d.ts +46 -46
  65. package/dist/utils/math.js +350 -351
  66. package/dist/utils/quantize-1d.d.ts +4 -4
  67. package/dist/utils/quantize-1d.js +164 -164
  68. package/dist/utils/sh-rotate.d.ts +2 -2
  69. package/dist/utils/sh-rotate.js +236 -175
  70. package/dist/utils/splat.d.ts +21 -20
  71. package/dist/utils/splat.js +397 -378
  72. package/dist/utils/voxel/binary.d.ts +8 -0
  73. package/dist/utils/voxel/binary.js +176 -0
  74. package/dist/utils/voxel/common.d.ts +178 -162
  75. package/dist/utils/voxel/common.js +1752 -1700
  76. package/dist/utils/voxel/coplanar-merge.d.ts +63 -63
  77. package/dist/utils/voxel/coplanar-merge.js +818 -819
  78. package/dist/utils/voxel/filter-cluster.d.ts +20 -0
  79. package/dist/utils/voxel/filter-cluster.js +628 -0
  80. package/dist/utils/voxel/gpu-dilation.d.ts +2 -2
  81. package/dist/utils/voxel/gpu-dilation.js +677 -665
  82. package/dist/utils/voxel/marching-cubes.d.ts +42 -42
  83. package/dist/utils/voxel/marching-cubes.js +1645 -1657
  84. package/dist/utils/voxel/mesh.d.ts +3 -3
  85. package/dist/utils/voxel/mesh.js +130 -130
  86. package/dist/utils/voxel/nav.d.ts +29 -29
  87. package/dist/utils/voxel/nav.js +1068 -1043
  88. package/dist/utils/voxel/postprocess.d.ts +23 -23
  89. package/dist/utils/voxel/postprocess.js +408 -375
  90. package/dist/utils/voxel/voxel-faces.d.ts +18 -18
  91. package/dist/utils/voxel/voxel-faces.js +662 -663
  92. package/dist/utils/voxel/voxelize.d.ts +34 -33
  93. package/dist/utils/voxel/voxelize.js +1208 -1193
  94. package/dist/utils/webgpu.d.ts +8 -8
  95. package/dist/utils/webgpu.js +122 -122
  96. package/package.json +37 -30
  97. package/dist/native/cpp/bin/linux/binding.node +0 -0
  98. 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 };