@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.
- package/CHANGELOG.md +120 -106
- package/COPYRIGHT.md +17 -0
- package/README.md +39 -39
- package/THIRD_PARTY_LICENSES.txt +1373 -0
- package/bin/cli.js +125 -118
- package/dist/SplatData.d.ts +67 -67
- package/dist/SplatData.js +167 -156
- package/dist/constant.d.ts +3 -3
- package/dist/constant.js +13 -13
- package/dist/file/IFile.d.ts +5 -5
- package/dist/file/IFile.js +1 -1
- package/dist/file/esz.d.ts +11 -0
- package/dist/file/esz.js +337 -0
- package/dist/file/index.d.ts +8 -7
- package/dist/file/index.js +7 -6
- package/dist/file/ksplat.d.ts +12 -12
- package/dist/file/ksplat.js +293 -232
- package/dist/file/lcc.d.ts +11 -11
- package/dist/file/lcc.js +161 -157
- package/dist/file/ply.d.ts +13 -13
- package/dist/file/ply.js +439 -388
- package/dist/file/sog.d.ts +80 -80
- package/dist/file/sog.js +525 -504
- package/dist/file/splat.d.ts +6 -6
- package/dist/file/splat.js +119 -99
- package/dist/file/spz.d.ts +11 -8
- package/dist/file/spz.js +597 -400
- package/dist/file/voxel.d.ts +43 -37
- package/dist/file/voxel.js +411 -280
- package/dist/index.d.ts +33 -33
- package/dist/index.js +54 -54
- package/dist/native/index.d.ts +54 -54
- package/dist/native/index.js +122 -128
- package/dist/native/utils.d.ts +1 -0
- package/dist/native/utils.js +54 -0
- package/dist/tasks/AutoChunkLodTask.d.ts +13 -13
- package/dist/tasks/AutoChunkLodTask.js +117 -117
- package/dist/tasks/AutoLodTask.d.ts +10 -10
- package/dist/tasks/AutoLodTask.js +20 -20
- package/dist/tasks/BaseTask.d.ts +15 -15
- package/dist/tasks/BaseTask.js +5 -5
- package/dist/tasks/FlexLodTask.d.ts +12 -12
- package/dist/tasks/FlexLodTask.js +54 -44
- package/dist/tasks/ModifyTask.d.ts +9 -9
- package/dist/tasks/ModifyTask.js +166 -156
- package/dist/tasks/ReadTask.d.ts +9 -9
- package/dist/tasks/ReadTask.js +29 -29
- package/dist/tasks/SkeletonLodTask.d.ts +10 -10
- package/dist/tasks/SkeletonLodTask.js +176 -156
- package/dist/tasks/VoxelTask.d.ts +35 -30
- package/dist/tasks/VoxelTask.js +40 -37
- package/dist/tasks/WriteTask.d.ts +12 -11
- package/dist/tasks/WriteTask.js +70 -70
- package/dist/utils/BufferReader.d.ts +12 -12
- package/dist/utils/BufferReader.js +45 -47
- package/dist/utils/Logger.d.ts +11 -11
- package/dist/utils/Logger.js +40 -38
- package/dist/utils/StreamChunkDecoder.d.ts +16 -16
- package/dist/utils/StreamChunkDecoder.js +31 -36
- package/dist/utils/index.d.ts +27 -27
- package/dist/utils/index.js +101 -101
- package/dist/utils/k-means.d.ts +4 -4
- package/dist/utils/k-means.js +340 -350
- package/dist/utils/math.d.ts +46 -46
- package/dist/utils/math.js +350 -351
- package/dist/utils/quantize-1d.d.ts +4 -4
- package/dist/utils/quantize-1d.js +164 -164
- package/dist/utils/sh-rotate.d.ts +2 -2
- package/dist/utils/sh-rotate.js +236 -175
- package/dist/utils/splat.d.ts +21 -20
- package/dist/utils/splat.js +397 -378
- package/dist/utils/voxel/binary.d.ts +8 -0
- package/dist/utils/voxel/binary.js +176 -0
- package/dist/utils/voxel/common.d.ts +178 -162
- package/dist/utils/voxel/common.js +1752 -1700
- package/dist/utils/voxel/coplanar-merge.d.ts +63 -63
- package/dist/utils/voxel/coplanar-merge.js +818 -819
- package/dist/utils/voxel/filter-cluster.d.ts +20 -0
- package/dist/utils/voxel/filter-cluster.js +628 -0
- package/dist/utils/voxel/gpu-dilation.d.ts +2 -2
- package/dist/utils/voxel/gpu-dilation.js +677 -665
- package/dist/utils/voxel/marching-cubes.d.ts +42 -42
- package/dist/utils/voxel/marching-cubes.js +1645 -1657
- package/dist/utils/voxel/mesh.d.ts +3 -3
- package/dist/utils/voxel/mesh.js +130 -130
- package/dist/utils/voxel/nav.d.ts +29 -29
- package/dist/utils/voxel/nav.js +1068 -1043
- package/dist/utils/voxel/postprocess.d.ts +23 -23
- package/dist/utils/voxel/postprocess.js +408 -375
- package/dist/utils/voxel/voxel-faces.d.ts +18 -18
- package/dist/utils/voxel/voxel-faces.js +662 -663
- package/dist/utils/voxel/voxelize.d.ts +34 -33
- package/dist/utils/voxel/voxelize.js +1208 -1193
- package/dist/utils/webgpu.d.ts +8 -8
- package/dist/utils/webgpu.js +122 -122
- package/package.json +37 -30
- package/dist/native/cpp/bin/linux/binding.node +0 -0
- package/dist/native/cpp/bin/windows/binding.node +0 -0
package/dist/utils/sh-rotate.js
CHANGED
|
@@ -1,175 +1,236 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Rotate spherical harmonics up to band 3 based on https://github.com/andrewwillmott/sh-lib
|
|
3
|
-
* This implementation calculates the rotation factors during construction which can then
|
|
4
|
-
* be used to rotate multiple spherical harmonics cheaply.
|
|
5
|
-
*/
|
|
6
|
-
const kSqrt03_02 = Math.sqrt(3.0 / 2.0);
|
|
7
|
-
const kSqrt01_03 = Math.sqrt(1.0 / 3.0);
|
|
8
|
-
const kSqrt02_03 = Math.sqrt(2.0 / 3.0);
|
|
9
|
-
const kSqrt04_03 = Math.sqrt(4.0 / 3.0);
|
|
10
|
-
const kSqrt01_04 = Math.sqrt(1.0 / 4.0);
|
|
11
|
-
const kSqrt03_04 = Math.sqrt(3.0 / 4.0);
|
|
12
|
-
const kSqrt01_05 = Math.sqrt(1.0 / 5.0);
|
|
13
|
-
const kSqrt03_05 = Math.sqrt(3.0 / 5.0);
|
|
14
|
-
const kSqrt06_05 = Math.sqrt(6.0 / 5.0);
|
|
15
|
-
const kSqrt08_05 = Math.sqrt(8.0 / 5.0);
|
|
16
|
-
const kSqrt09_05 = Math.sqrt(9.0 / 5.0);
|
|
17
|
-
const kSqrt01_06 = Math.sqrt(1.0 / 6.0);
|
|
18
|
-
const kSqrt05_06 = Math.sqrt(5.0 / 6.0);
|
|
19
|
-
const kSqrt03_08 = Math.sqrt(3.0 / 8.0);
|
|
20
|
-
const kSqrt05_08 = Math.sqrt(5.0 / 8.0);
|
|
21
|
-
const kSqrt09_08 = Math.sqrt(9.0 / 8.0);
|
|
22
|
-
const kSqrt05_09 = Math.sqrt(5.0 / 9.0);
|
|
23
|
-
const kSqrt08_09 = Math.sqrt(8.0 / 9.0);
|
|
24
|
-
const kSqrt01_10 = Math.sqrt(1.0 / 10.0);
|
|
25
|
-
const kSqrt03_10 = Math.sqrt(3.0 / 10.0);
|
|
26
|
-
const kSqrt01_12 = Math.sqrt(1.0 / 12.0);
|
|
27
|
-
const kSqrt04_15 = Math.sqrt(4.0 / 15.0);
|
|
28
|
-
const kSqrt01_16 = Math.sqrt(1.0 / 16.0);
|
|
29
|
-
const kSqrt15_16 = Math.sqrt(15.0 / 16.0);
|
|
30
|
-
const kSqrt01_18 = Math.sqrt(1.0 / 18.0);
|
|
31
|
-
const kSqrt01_60 = Math.sqrt(1.0 / 60.0);
|
|
32
|
-
export function createSHRotateFn(mat) {
|
|
33
|
-
const rot = mat.elements;
|
|
34
|
-
const sh1 = [
|
|
35
|
-
[rot[4], -rot[7], rot[1]],
|
|
36
|
-
[-rot[5], rot[8], -rot[2]],
|
|
37
|
-
[rot[3], -rot[6], rot[0]],
|
|
38
|
-
];
|
|
39
|
-
const sh2 = [
|
|
40
|
-
[
|
|
41
|
-
kSqrt01_04 *
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
(sh1[2][1] * sh1[0][
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
kSqrt01_03 * (sh1[1][2] * sh1[1][
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
sh1[1][1] * sh1[
|
|
63
|
-
|
|
64
|
-
sh1[1][1] * sh1[
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
sh1[1][1] * sh2[
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
kSqrt08_05 * sh1[1][1] * sh2[
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
sh1[1][1] * sh2[
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Rotate spherical harmonics up to band 3 based on https://github.com/andrewwillmott/sh-lib
|
|
3
|
+
* This implementation calculates the rotation factors during construction which can then
|
|
4
|
+
* be used to rotate multiple spherical harmonics cheaply.
|
|
5
|
+
*/
|
|
6
|
+
const kSqrt03_02 = Math.sqrt(3.0 / 2.0);
|
|
7
|
+
const kSqrt01_03 = Math.sqrt(1.0 / 3.0);
|
|
8
|
+
const kSqrt02_03 = Math.sqrt(2.0 / 3.0);
|
|
9
|
+
const kSqrt04_03 = Math.sqrt(4.0 / 3.0);
|
|
10
|
+
const kSqrt01_04 = Math.sqrt(1.0 / 4.0);
|
|
11
|
+
const kSqrt03_04 = Math.sqrt(3.0 / 4.0);
|
|
12
|
+
const kSqrt01_05 = Math.sqrt(1.0 / 5.0);
|
|
13
|
+
const kSqrt03_05 = Math.sqrt(3.0 / 5.0);
|
|
14
|
+
const kSqrt06_05 = Math.sqrt(6.0 / 5.0);
|
|
15
|
+
const kSqrt08_05 = Math.sqrt(8.0 / 5.0);
|
|
16
|
+
const kSqrt09_05 = Math.sqrt(9.0 / 5.0);
|
|
17
|
+
const kSqrt01_06 = Math.sqrt(1.0 / 6.0);
|
|
18
|
+
const kSqrt05_06 = Math.sqrt(5.0 / 6.0);
|
|
19
|
+
const kSqrt03_08 = Math.sqrt(3.0 / 8.0);
|
|
20
|
+
const kSqrt05_08 = Math.sqrt(5.0 / 8.0);
|
|
21
|
+
const kSqrt09_08 = Math.sqrt(9.0 / 8.0);
|
|
22
|
+
const kSqrt05_09 = Math.sqrt(5.0 / 9.0);
|
|
23
|
+
const kSqrt08_09 = Math.sqrt(8.0 / 9.0);
|
|
24
|
+
const kSqrt01_10 = Math.sqrt(1.0 / 10.0);
|
|
25
|
+
const kSqrt03_10 = Math.sqrt(3.0 / 10.0);
|
|
26
|
+
const kSqrt01_12 = Math.sqrt(1.0 / 12.0);
|
|
27
|
+
const kSqrt04_15 = Math.sqrt(4.0 / 15.0);
|
|
28
|
+
const kSqrt01_16 = Math.sqrt(1.0 / 16.0);
|
|
29
|
+
const kSqrt15_16 = Math.sqrt(15.0 / 16.0);
|
|
30
|
+
const kSqrt01_18 = Math.sqrt(1.0 / 18.0);
|
|
31
|
+
const kSqrt01_60 = Math.sqrt(1.0 / 60.0);
|
|
32
|
+
export function createSHRotateFn(mat) {
|
|
33
|
+
const rot = mat.elements;
|
|
34
|
+
const sh1 = [
|
|
35
|
+
[rot[4], -rot[7], rot[1]],
|
|
36
|
+
[-rot[5], rot[8], -rot[2]],
|
|
37
|
+
[rot[3], -rot[6], rot[0]],
|
|
38
|
+
];
|
|
39
|
+
const sh2 = [
|
|
40
|
+
[
|
|
41
|
+
kSqrt01_04 *
|
|
42
|
+
(sh1[2][2] * sh1[0][0] + sh1[2][0] * sh1[0][2] + (sh1[0][2] * sh1[2][0] + sh1[0][0] * sh1[2][2])),
|
|
43
|
+
sh1[2][1] * sh1[0][0] + sh1[0][1] * sh1[2][0],
|
|
44
|
+
kSqrt03_04 * (sh1[2][1] * sh1[0][1] + sh1[0][1] * sh1[2][1]),
|
|
45
|
+
sh1[2][1] * sh1[0][2] + sh1[0][1] * sh1[2][2],
|
|
46
|
+
kSqrt01_04 *
|
|
47
|
+
(sh1[2][2] * sh1[0][2] - sh1[2][0] * sh1[0][0] + (sh1[0][2] * sh1[2][2] - sh1[0][0] * sh1[2][0])),
|
|
48
|
+
],
|
|
49
|
+
[
|
|
50
|
+
kSqrt01_04 *
|
|
51
|
+
(sh1[1][2] * sh1[0][0] + sh1[1][0] * sh1[0][2] + (sh1[0][2] * sh1[1][0] + sh1[0][0] * sh1[1][2])),
|
|
52
|
+
sh1[1][1] * sh1[0][0] + sh1[0][1] * sh1[1][0],
|
|
53
|
+
kSqrt03_04 * (sh1[1][1] * sh1[0][1] + sh1[0][1] * sh1[1][1]),
|
|
54
|
+
sh1[1][1] * sh1[0][2] + sh1[0][1] * sh1[1][2],
|
|
55
|
+
kSqrt01_04 *
|
|
56
|
+
(sh1[1][2] * sh1[0][2] - sh1[1][0] * sh1[0][0] + (sh1[0][2] * sh1[1][2] - sh1[0][0] * sh1[1][0])),
|
|
57
|
+
],
|
|
58
|
+
[
|
|
59
|
+
kSqrt01_03 * (sh1[1][2] * sh1[1][0] + sh1[1][0] * sh1[1][2]) -
|
|
60
|
+
kSqrt01_12 *
|
|
61
|
+
(sh1[2][2] * sh1[2][0] + sh1[2][0] * sh1[2][2] + (sh1[0][2] * sh1[0][0] + sh1[0][0] * sh1[0][2])),
|
|
62
|
+
kSqrt04_03 * sh1[1][1] * sh1[1][0] - kSqrt01_03 * (sh1[2][1] * sh1[2][0] + sh1[0][1] * sh1[0][0]),
|
|
63
|
+
sh1[1][1] * sh1[1][1] - kSqrt01_04 * (sh1[2][1] * sh1[2][1] + sh1[0][1] * sh1[0][1]),
|
|
64
|
+
kSqrt04_03 * sh1[1][1] * sh1[1][2] - kSqrt01_03 * (sh1[2][1] * sh1[2][2] + sh1[0][1] * sh1[0][2]),
|
|
65
|
+
kSqrt01_03 * (sh1[1][2] * sh1[1][2] - sh1[1][0] * sh1[1][0]) -
|
|
66
|
+
kSqrt01_12 *
|
|
67
|
+
(sh1[2][2] * sh1[2][2] - sh1[2][0] * sh1[2][0] + (sh1[0][2] * sh1[0][2] - sh1[0][0] * sh1[0][0])),
|
|
68
|
+
],
|
|
69
|
+
[
|
|
70
|
+
kSqrt01_04 *
|
|
71
|
+
(sh1[1][2] * sh1[2][0] + sh1[1][0] * sh1[2][2] + (sh1[2][2] * sh1[1][0] + sh1[2][0] * sh1[1][2])),
|
|
72
|
+
sh1[1][1] * sh1[2][0] + sh1[2][1] * sh1[1][0],
|
|
73
|
+
kSqrt03_04 * (sh1[1][1] * sh1[2][1] + sh1[2][1] * sh1[1][1]),
|
|
74
|
+
sh1[1][1] * sh1[2][2] + sh1[2][1] * sh1[1][2],
|
|
75
|
+
kSqrt01_04 *
|
|
76
|
+
(sh1[1][2] * sh1[2][2] - sh1[1][0] * sh1[2][0] + (sh1[2][2] * sh1[1][2] - sh1[2][0] * sh1[1][0])),
|
|
77
|
+
],
|
|
78
|
+
[
|
|
79
|
+
kSqrt01_04 *
|
|
80
|
+
(sh1[2][2] * sh1[2][0] + sh1[2][0] * sh1[2][2] - (sh1[0][2] * sh1[0][0] + sh1[0][0] * sh1[0][2])),
|
|
81
|
+
sh1[2][1] * sh1[2][0] - sh1[0][1] * sh1[0][0],
|
|
82
|
+
kSqrt03_04 * (sh1[2][1] * sh1[2][1] - sh1[0][1] * sh1[0][1]),
|
|
83
|
+
sh1[2][1] * sh1[2][2] - sh1[0][1] * sh1[0][2],
|
|
84
|
+
kSqrt01_04 *
|
|
85
|
+
(sh1[2][2] * sh1[2][2] - sh1[2][0] * sh1[2][0] - (sh1[0][2] * sh1[0][2] - sh1[0][0] * sh1[0][0])),
|
|
86
|
+
],
|
|
87
|
+
];
|
|
88
|
+
const sh3 = [
|
|
89
|
+
[
|
|
90
|
+
kSqrt01_04 *
|
|
91
|
+
(sh1[2][2] * sh2[0][0] + sh1[2][0] * sh2[0][4] + (sh1[0][2] * sh2[4][0] + sh1[0][0] * sh2[4][4])),
|
|
92
|
+
kSqrt03_02 * (sh1[2][1] * sh2[0][0] + sh1[0][1] * sh2[4][0]),
|
|
93
|
+
kSqrt15_16 * (sh1[2][1] * sh2[0][1] + sh1[0][1] * sh2[4][1]),
|
|
94
|
+
kSqrt05_06 * (sh1[2][1] * sh2[0][2] + sh1[0][1] * sh2[4][2]),
|
|
95
|
+
kSqrt15_16 * (sh1[2][1] * sh2[0][3] + sh1[0][1] * sh2[4][3]),
|
|
96
|
+
kSqrt03_02 * (sh1[2][1] * sh2[0][4] + sh1[0][1] * sh2[4][4]),
|
|
97
|
+
kSqrt01_04 *
|
|
98
|
+
(sh1[2][2] * sh2[0][4] - sh1[2][0] * sh2[0][0] + (sh1[0][2] * sh2[4][4] - sh1[0][0] * sh2[4][0])),
|
|
99
|
+
],
|
|
100
|
+
[
|
|
101
|
+
kSqrt01_06 * (sh1[1][2] * sh2[0][0] + sh1[1][0] * sh2[0][4]) +
|
|
102
|
+
kSqrt01_06 *
|
|
103
|
+
(sh1[2][2] * sh2[1][0] + sh1[2][0] * sh2[1][4] + (sh1[0][2] * sh2[3][0] + sh1[0][0] * sh2[3][4])),
|
|
104
|
+
sh1[1][1] * sh2[0][0] + (sh1[2][1] * sh2[1][0] + sh1[0][1] * sh2[3][0]),
|
|
105
|
+
kSqrt05_08 * sh1[1][1] * sh2[0][1] + kSqrt05_08 * (sh1[2][1] * sh2[1][1] + sh1[0][1] * sh2[3][1]),
|
|
106
|
+
kSqrt05_09 * sh1[1][1] * sh2[0][2] + kSqrt05_09 * (sh1[2][1] * sh2[1][2] + sh1[0][1] * sh2[3][2]),
|
|
107
|
+
kSqrt05_08 * sh1[1][1] * sh2[0][3] + kSqrt05_08 * (sh1[2][1] * sh2[1][3] + sh1[0][1] * sh2[3][3]),
|
|
108
|
+
sh1[1][1] * sh2[0][4] + (sh1[2][1] * sh2[1][4] + sh1[0][1] * sh2[3][4]),
|
|
109
|
+
kSqrt01_06 * (sh1[1][2] * sh2[0][4] - sh1[1][0] * sh2[0][0]) +
|
|
110
|
+
kSqrt01_06 *
|
|
111
|
+
(sh1[2][2] * sh2[1][4] - sh1[2][0] * sh2[1][0] + (sh1[0][2] * sh2[3][4] - sh1[0][0] * sh2[3][0])),
|
|
112
|
+
],
|
|
113
|
+
[
|
|
114
|
+
kSqrt04_15 * (sh1[1][2] * sh2[1][0] + sh1[1][0] * sh2[1][4]) +
|
|
115
|
+
kSqrt01_05 * (sh1[0][2] * sh2[2][0] + sh1[0][0] * sh2[2][4]) -
|
|
116
|
+
kSqrt01_60 *
|
|
117
|
+
(sh1[2][2] * sh2[0][0] + sh1[2][0] * sh2[0][4] - (sh1[0][2] * sh2[4][0] + sh1[0][0] * sh2[4][4])),
|
|
118
|
+
kSqrt08_05 * sh1[1][1] * sh2[1][0] +
|
|
119
|
+
kSqrt06_05 * sh1[0][1] * sh2[2][0] -
|
|
120
|
+
kSqrt01_10 * (sh1[2][1] * sh2[0][0] - sh1[0][1] * sh2[4][0]),
|
|
121
|
+
sh1[1][1] * sh2[1][1] +
|
|
122
|
+
kSqrt03_04 * sh1[0][1] * sh2[2][1] -
|
|
123
|
+
kSqrt01_16 * (sh1[2][1] * sh2[0][1] - sh1[0][1] * sh2[4][1]),
|
|
124
|
+
kSqrt08_09 * sh1[1][1] * sh2[1][2] +
|
|
125
|
+
kSqrt02_03 * sh1[0][1] * sh2[2][2] -
|
|
126
|
+
kSqrt01_18 * (sh1[2][1] * sh2[0][2] - sh1[0][1] * sh2[4][2]),
|
|
127
|
+
sh1[1][1] * sh2[1][3] +
|
|
128
|
+
kSqrt03_04 * sh1[0][1] * sh2[2][3] -
|
|
129
|
+
kSqrt01_16 * (sh1[2][1] * sh2[0][3] - sh1[0][1] * sh2[4][3]),
|
|
130
|
+
kSqrt08_05 * sh1[1][1] * sh2[1][4] +
|
|
131
|
+
kSqrt06_05 * sh1[0][1] * sh2[2][4] -
|
|
132
|
+
kSqrt01_10 * (sh1[2][1] * sh2[0][4] - sh1[0][1] * sh2[4][4]),
|
|
133
|
+
kSqrt04_15 * (sh1[1][2] * sh2[1][4] - sh1[1][0] * sh2[1][0]) +
|
|
134
|
+
kSqrt01_05 * (sh1[0][2] * sh2[2][4] - sh1[0][0] * sh2[2][0]) -
|
|
135
|
+
kSqrt01_60 *
|
|
136
|
+
(sh1[2][2] * sh2[0][4] - sh1[2][0] * sh2[0][0] - (sh1[0][2] * sh2[4][4] - sh1[0][0] * sh2[4][0])),
|
|
137
|
+
],
|
|
138
|
+
[
|
|
139
|
+
kSqrt03_10 * (sh1[1][2] * sh2[2][0] + sh1[1][0] * sh2[2][4]) -
|
|
140
|
+
kSqrt01_10 *
|
|
141
|
+
(sh1[2][2] * sh2[3][0] + sh1[2][0] * sh2[3][4] + (sh1[0][2] * sh2[1][0] + sh1[0][0] * sh2[1][4])),
|
|
142
|
+
kSqrt09_05 * sh1[1][1] * sh2[2][0] - kSqrt03_05 * (sh1[2][1] * sh2[3][0] + sh1[0][1] * sh2[1][0]),
|
|
143
|
+
kSqrt09_08 * sh1[1][1] * sh2[2][1] - kSqrt03_08 * (sh1[2][1] * sh2[3][1] + sh1[0][1] * sh2[1][1]),
|
|
144
|
+
sh1[1][1] * sh2[2][2] - kSqrt01_03 * (sh1[2][1] * sh2[3][2] + sh1[0][1] * sh2[1][2]),
|
|
145
|
+
kSqrt09_08 * sh1[1][1] * sh2[2][3] - kSqrt03_08 * (sh1[2][1] * sh2[3][3] + sh1[0][1] * sh2[1][3]),
|
|
146
|
+
kSqrt09_05 * sh1[1][1] * sh2[2][4] - kSqrt03_05 * (sh1[2][1] * sh2[3][4] + sh1[0][1] * sh2[1][4]),
|
|
147
|
+
kSqrt03_10 * (sh1[1][2] * sh2[2][4] - sh1[1][0] * sh2[2][0]) -
|
|
148
|
+
kSqrt01_10 *
|
|
149
|
+
(sh1[2][2] * sh2[3][4] - sh1[2][0] * sh2[3][0] + (sh1[0][2] * sh2[1][4] - sh1[0][0] * sh2[1][0])),
|
|
150
|
+
],
|
|
151
|
+
[
|
|
152
|
+
kSqrt04_15 * (sh1[1][2] * sh2[3][0] + sh1[1][0] * sh2[3][4]) +
|
|
153
|
+
kSqrt01_05 * (sh1[2][2] * sh2[2][0] + sh1[2][0] * sh2[2][4]) -
|
|
154
|
+
kSqrt01_60 *
|
|
155
|
+
(sh1[2][2] * sh2[4][0] + sh1[2][0] * sh2[4][4] + (sh1[0][2] * sh2[0][0] + sh1[0][0] * sh2[0][4])),
|
|
156
|
+
kSqrt08_05 * sh1[1][1] * sh2[3][0] +
|
|
157
|
+
kSqrt06_05 * sh1[2][1] * sh2[2][0] -
|
|
158
|
+
kSqrt01_10 * (sh1[2][1] * sh2[4][0] + sh1[0][1] * sh2[0][0]),
|
|
159
|
+
sh1[1][1] * sh2[3][1] +
|
|
160
|
+
kSqrt03_04 * sh1[2][1] * sh2[2][1] -
|
|
161
|
+
kSqrt01_16 * (sh1[2][1] * sh2[4][1] + sh1[0][1] * sh2[0][1]),
|
|
162
|
+
kSqrt08_09 * sh1[1][1] * sh2[3][2] +
|
|
163
|
+
kSqrt02_03 * sh1[2][1] * sh2[2][2] -
|
|
164
|
+
kSqrt01_18 * (sh1[2][1] * sh2[4][2] + sh1[0][1] * sh2[0][2]),
|
|
165
|
+
sh1[1][1] * sh2[3][3] +
|
|
166
|
+
kSqrt03_04 * sh1[2][1] * sh2[2][3] -
|
|
167
|
+
kSqrt01_16 * (sh1[2][1] * sh2[4][3] + sh1[0][1] * sh2[0][3]),
|
|
168
|
+
kSqrt08_05 * sh1[1][1] * sh2[3][4] +
|
|
169
|
+
kSqrt06_05 * sh1[2][1] * sh2[2][4] -
|
|
170
|
+
kSqrt01_10 * (sh1[2][1] * sh2[4][4] + sh1[0][1] * sh2[0][4]),
|
|
171
|
+
kSqrt04_15 * (sh1[1][2] * sh2[3][4] - sh1[1][0] * sh2[3][0]) +
|
|
172
|
+
kSqrt01_05 * (sh1[2][2] * sh2[2][4] - sh1[2][0] * sh2[2][0]) -
|
|
173
|
+
kSqrt01_60 *
|
|
174
|
+
(sh1[2][2] * sh2[4][4] - sh1[2][0] * sh2[4][0] + (sh1[0][2] * sh2[0][4] - sh1[0][0] * sh2[0][0])),
|
|
175
|
+
],
|
|
176
|
+
[
|
|
177
|
+
kSqrt01_06 * (sh1[1][2] * sh2[4][0] + sh1[1][0] * sh2[4][4]) +
|
|
178
|
+
kSqrt01_06 *
|
|
179
|
+
(sh1[2][2] * sh2[3][0] + sh1[2][0] * sh2[3][4] - (sh1[0][2] * sh2[1][0] + sh1[0][0] * sh2[1][4])),
|
|
180
|
+
sh1[1][1] * sh2[4][0] + (sh1[2][1] * sh2[3][0] - sh1[0][1] * sh2[1][0]),
|
|
181
|
+
kSqrt05_08 * sh1[1][1] * sh2[4][1] + kSqrt05_08 * (sh1[2][1] * sh2[3][1] - sh1[0][1] * sh2[1][1]),
|
|
182
|
+
kSqrt05_09 * sh1[1][1] * sh2[4][2] + kSqrt05_09 * (sh1[2][1] * sh2[3][2] - sh1[0][1] * sh2[1][2]),
|
|
183
|
+
kSqrt05_08 * sh1[1][1] * sh2[4][3] + kSqrt05_08 * (sh1[2][1] * sh2[3][3] - sh1[0][1] * sh2[1][3]),
|
|
184
|
+
sh1[1][1] * sh2[4][4] + (sh1[2][1] * sh2[3][4] - sh1[0][1] * sh2[1][4]),
|
|
185
|
+
kSqrt01_06 * (sh1[1][2] * sh2[4][4] - sh1[1][0] * sh2[4][0]) +
|
|
186
|
+
kSqrt01_06 *
|
|
187
|
+
(sh1[2][2] * sh2[3][4] - sh1[2][0] * sh2[3][0] - (sh1[0][2] * sh2[1][4] - sh1[0][0] * sh2[1][0])),
|
|
188
|
+
],
|
|
189
|
+
[
|
|
190
|
+
kSqrt01_04 *
|
|
191
|
+
(sh1[2][2] * sh2[4][0] + sh1[2][0] * sh2[4][4] - (sh1[0][2] * sh2[0][0] + sh1[0][0] * sh2[0][4])),
|
|
192
|
+
kSqrt03_02 * (sh1[2][1] * sh2[4][0] - sh1[0][1] * sh2[0][0]),
|
|
193
|
+
kSqrt15_16 * (sh1[2][1] * sh2[4][1] - sh1[0][1] * sh2[0][1]),
|
|
194
|
+
kSqrt05_06 * (sh1[2][1] * sh2[4][2] - sh1[0][1] * sh2[0][2]),
|
|
195
|
+
kSqrt15_16 * (sh1[2][1] * sh2[4][3] - sh1[0][1] * sh2[0][3]),
|
|
196
|
+
kSqrt03_02 * (sh1[2][1] * sh2[4][4] - sh1[0][1] * sh2[0][4]),
|
|
197
|
+
kSqrt01_04 *
|
|
198
|
+
(sh1[2][2] * sh2[4][4] - sh1[2][0] * sh2[4][0] - (sh1[0][2] * sh2[0][4] - sh1[0][0] * sh2[0][0])),
|
|
199
|
+
],
|
|
200
|
+
];
|
|
201
|
+
const dp = (n, start, a, b) => {
|
|
202
|
+
let sum = 0;
|
|
203
|
+
for (let i = 0; i < n; i++) {
|
|
204
|
+
sum += a[start + i] * b[i];
|
|
205
|
+
}
|
|
206
|
+
return sum;
|
|
207
|
+
};
|
|
208
|
+
const temp = new Float32Array(15);
|
|
209
|
+
return (shN) => {
|
|
210
|
+
temp.set(shN);
|
|
211
|
+
if (shN.length < 3) {
|
|
212
|
+
return;
|
|
213
|
+
}
|
|
214
|
+
shN[0] = dp(3, 0, temp, sh1[0]);
|
|
215
|
+
shN[1] = dp(3, 0, temp, sh1[1]);
|
|
216
|
+
shN[2] = dp(3, 0, temp, sh1[2]);
|
|
217
|
+
if (shN.length < 8) {
|
|
218
|
+
return;
|
|
219
|
+
}
|
|
220
|
+
shN[3] = dp(5, 3, temp, sh2[0]);
|
|
221
|
+
shN[4] = dp(5, 3, temp, sh2[1]);
|
|
222
|
+
shN[5] = dp(5, 3, temp, sh2[2]);
|
|
223
|
+
shN[6] = dp(5, 3, temp, sh2[3]);
|
|
224
|
+
shN[7] = dp(5, 3, temp, sh2[4]);
|
|
225
|
+
if (shN.length < 15) {
|
|
226
|
+
return;
|
|
227
|
+
}
|
|
228
|
+
shN[8] = dp(7, 8, temp, sh3[0]);
|
|
229
|
+
shN[9] = dp(7, 8, temp, sh3[1]);
|
|
230
|
+
shN[10] = dp(7, 8, temp, sh3[2]);
|
|
231
|
+
shN[11] = dp(7, 8, temp, sh3[3]);
|
|
232
|
+
shN[12] = dp(7, 8, temp, sh3[4]);
|
|
233
|
+
shN[13] = dp(7, 8, temp, sh3[5]);
|
|
234
|
+
shN[14] = dp(7, 8, temp, sh3[6]);
|
|
235
|
+
};
|
|
236
|
+
}
|
package/dist/utils/splat.d.ts
CHANGED
|
@@ -1,20 +1,21 @@
|
|
|
1
|
-
import { IFile } from '../file/index.js';
|
|
2
|
-
import { SplatData } from '../SplatData.js';
|
|
3
|
-
export declare enum SplatFileType {
|
|
4
|
-
PLY = 0,
|
|
5
|
-
SPZ = 1,
|
|
6
|
-
USPZ = 2,// not gzip spz
|
|
7
|
-
SPLAT = 3,
|
|
8
|
-
KSPLAT = 4,
|
|
9
|
-
SOG = 5,
|
|
10
|
-
LCC = 6
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
export declare function
|
|
14
|
-
export declare function
|
|
15
|
-
export declare function
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
export declare function
|
|
1
|
+
import { type IFile } from '../file/index.js';
|
|
2
|
+
import { SplatData } from '../SplatData.js';
|
|
3
|
+
export declare enum SplatFileType {
|
|
4
|
+
PLY = 0,
|
|
5
|
+
SPZ = 1,
|
|
6
|
+
USPZ = 2,// not gzip spz
|
|
7
|
+
SPLAT = 3,
|
|
8
|
+
KSPLAT = 4,
|
|
9
|
+
SOG = 5,
|
|
10
|
+
LCC = 6,
|
|
11
|
+
ESZ = 7
|
|
12
|
+
}
|
|
13
|
+
export declare function detectSplatFileType(filename: string, buffer?: Uint8Array): SplatFileType | undefined;
|
|
14
|
+
export declare function createSplatFile(path: string, buffer?: Uint8Array, compressLevel?: number, spzVersion?: number): IFile;
|
|
15
|
+
export declare function combineSplatData(source: SplatData[]): SplatData;
|
|
16
|
+
export declare function computeDenseBox(data: SplatData, ratio?: number): {
|
|
17
|
+
min: number[];
|
|
18
|
+
max: number[];
|
|
19
|
+
};
|
|
20
|
+
export declare function mortonSort(splat: SplatData): Uint32Array;
|
|
21
|
+
export declare function fastDeleteSplat(splat: SplatData, indices: number[]): void;
|