@aics/vole-core 3.12.4
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/LICENSE.txt +26 -0
- package/README.md +119 -0
- package/es/Atlas2DSlice.js +224 -0
- package/es/Channel.js +264 -0
- package/es/FileSaver.js +31 -0
- package/es/FusedChannelData.js +192 -0
- package/es/Histogram.js +250 -0
- package/es/ImageInfo.js +127 -0
- package/es/Light.js +74 -0
- package/es/Lut.js +500 -0
- package/es/MarchingCubes.js +507 -0
- package/es/MeshVolume.js +334 -0
- package/es/NaiveSurfaceNets.js +251 -0
- package/es/PathTracedVolume.js +482 -0
- package/es/RayMarchedAtlasVolume.js +250 -0
- package/es/RenderToBuffer.js +31 -0
- package/es/ThreeJsPanel.js +633 -0
- package/es/Timing.js +28 -0
- package/es/TrackballControls.js +538 -0
- package/es/View3d.js +848 -0
- package/es/Volume.js +352 -0
- package/es/VolumeCache.js +161 -0
- package/es/VolumeDims.js +16 -0
- package/es/VolumeDrawable.js +702 -0
- package/es/VolumeMaker.js +101 -0
- package/es/VolumeRenderImpl.js +1 -0
- package/es/VolumeRenderSettings.js +203 -0
- package/es/constants/basicShaders.js +29 -0
- package/es/constants/colors.js +59 -0
- package/es/constants/denoiseShader.js +43 -0
- package/es/constants/lights.js +42 -0
- package/es/constants/materials.js +85 -0
- package/es/constants/pathtraceOutputShader.js +13 -0
- package/es/constants/scaleBarSVG.js +21 -0
- package/es/constants/time.js +34 -0
- package/es/constants/volumePTshader.js +153 -0
- package/es/constants/volumeRayMarchShader.js +123 -0
- package/es/constants/volumeSliceShader.js +115 -0
- package/es/index.js +21 -0
- package/es/loaders/IVolumeLoader.js +131 -0
- package/es/loaders/JsonImageInfoLoader.js +255 -0
- package/es/loaders/OmeZarrLoader.js +495 -0
- package/es/loaders/OpenCellLoader.js +65 -0
- package/es/loaders/RawArrayLoader.js +89 -0
- package/es/loaders/TiffLoader.js +219 -0
- package/es/loaders/VolumeLoadError.js +44 -0
- package/es/loaders/VolumeLoaderUtils.js +221 -0
- package/es/loaders/index.js +40 -0
- package/es/loaders/zarr_utils/ChunkPrefetchIterator.js +143 -0
- package/es/loaders/zarr_utils/WrappedStore.js +51 -0
- package/es/loaders/zarr_utils/types.js +24 -0
- package/es/loaders/zarr_utils/utils.js +225 -0
- package/es/loaders/zarr_utils/validation.js +49 -0
- package/es/test/ChunkPrefetchIterator.test.js +208 -0
- package/es/test/RequestQueue.test.js +442 -0
- package/es/test/SubscribableRequestQueue.test.js +244 -0
- package/es/test/VolumeCache.test.js +118 -0
- package/es/test/VolumeRenderSettings.test.js +71 -0
- package/es/test/lut.test.js +671 -0
- package/es/test/num_utils.test.js +140 -0
- package/es/test/volume.test.js +98 -0
- package/es/test/zarr_utils.test.js +358 -0
- package/es/types/Atlas2DSlice.d.ts +41 -0
- package/es/types/Channel.d.ts +44 -0
- package/es/types/FileSaver.d.ts +6 -0
- package/es/types/FusedChannelData.d.ts +26 -0
- package/es/types/Histogram.d.ts +57 -0
- package/es/types/ImageInfo.d.ts +87 -0
- package/es/types/Light.d.ts +27 -0
- package/es/types/Lut.d.ts +67 -0
- package/es/types/MarchingCubes.d.ts +53 -0
- package/es/types/MeshVolume.d.ts +40 -0
- package/es/types/NaiveSurfaceNets.d.ts +11 -0
- package/es/types/PathTracedVolume.d.ts +65 -0
- package/es/types/RayMarchedAtlasVolume.d.ts +41 -0
- package/es/types/RenderToBuffer.d.ts +17 -0
- package/es/types/ThreeJsPanel.d.ts +107 -0
- package/es/types/Timing.d.ts +11 -0
- package/es/types/TrackballControls.d.ts +51 -0
- package/es/types/View3d.d.ts +357 -0
- package/es/types/Volume.d.ts +152 -0
- package/es/types/VolumeCache.d.ts +43 -0
- package/es/types/VolumeDims.d.ts +28 -0
- package/es/types/VolumeDrawable.d.ts +108 -0
- package/es/types/VolumeMaker.d.ts +49 -0
- package/es/types/VolumeRenderImpl.d.ts +22 -0
- package/es/types/VolumeRenderSettings.d.ts +98 -0
- package/es/types/constants/basicShaders.d.ts +4 -0
- package/es/types/constants/colors.d.ts +2 -0
- package/es/types/constants/denoiseShader.d.ts +40 -0
- package/es/types/constants/lights.d.ts +38 -0
- package/es/types/constants/materials.d.ts +20 -0
- package/es/types/constants/pathtraceOutputShader.d.ts +11 -0
- package/es/types/constants/scaleBarSVG.d.ts +2 -0
- package/es/types/constants/time.d.ts +19 -0
- package/es/types/constants/volumePTshader.d.ts +137 -0
- package/es/types/constants/volumeRayMarchShader.d.ts +117 -0
- package/es/types/constants/volumeSliceShader.d.ts +109 -0
- package/es/types/glsl.d.js +0 -0
- package/es/types/index.d.ts +28 -0
- package/es/types/loaders/IVolumeLoader.d.ts +113 -0
- package/es/types/loaders/JsonImageInfoLoader.d.ts +80 -0
- package/es/types/loaders/OmeZarrLoader.d.ts +87 -0
- package/es/types/loaders/OpenCellLoader.d.ts +9 -0
- package/es/types/loaders/RawArrayLoader.d.ts +33 -0
- package/es/types/loaders/TiffLoader.d.ts +45 -0
- package/es/types/loaders/VolumeLoadError.d.ts +18 -0
- package/es/types/loaders/VolumeLoaderUtils.d.ts +38 -0
- package/es/types/loaders/index.d.ts +22 -0
- package/es/types/loaders/zarr_utils/ChunkPrefetchIterator.d.ts +22 -0
- package/es/types/loaders/zarr_utils/WrappedStore.d.ts +24 -0
- package/es/types/loaders/zarr_utils/types.d.ts +94 -0
- package/es/types/loaders/zarr_utils/utils.d.ts +23 -0
- package/es/types/loaders/zarr_utils/validation.d.ts +7 -0
- package/es/types/test/ChunkPrefetchIterator.test.d.ts +1 -0
- package/es/types/test/RequestQueue.test.d.ts +1 -0
- package/es/types/test/SubscribableRequestQueue.test.d.ts +1 -0
- package/es/types/test/VolumeCache.test.d.ts +1 -0
- package/es/types/test/VolumeRenderSettings.test.d.ts +1 -0
- package/es/types/test/lut.test.d.ts +1 -0
- package/es/types/test/num_utils.test.d.ts +1 -0
- package/es/types/test/volume.test.d.ts +1 -0
- package/es/types/test/zarr_utils.test.d.ts +1 -0
- package/es/types/types.d.ts +115 -0
- package/es/types/utils/RequestQueue.d.ts +112 -0
- package/es/types/utils/SubscribableRequestQueue.d.ts +52 -0
- package/es/types/utils/num_utils.d.ts +43 -0
- package/es/types/workers/VolumeLoaderContext.d.ts +106 -0
- package/es/types/workers/types.d.ts +101 -0
- package/es/types/workers/util.d.ts +3 -0
- package/es/types.js +75 -0
- package/es/typings.d.js +0 -0
- package/es/utils/RequestQueue.js +267 -0
- package/es/utils/SubscribableRequestQueue.js +187 -0
- package/es/utils/num_utils.js +231 -0
- package/es/workers/FetchTiffWorker.js +153 -0
- package/es/workers/VolumeLoadWorker.js +129 -0
- package/es/workers/VolumeLoaderContext.js +271 -0
- package/es/workers/types.js +41 -0
- package/es/workers/util.js +8 -0
- package/package.json +83 -0
|
@@ -0,0 +1,507 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Port of http://webglsamples.org/blob/blob.html
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
// MODIFIED 2018-2022 BY DANIELT@ALLENINSTITUTE.ORG TO ACCEPT enableColors, enableNormals, volumeFieldRef options
|
|
6
|
+
|
|
7
|
+
import { BufferAttribute, BufferGeometry, Mesh } from "three";
|
|
8
|
+
class MarchingCubes extends Mesh {
|
|
9
|
+
//4096; // TODO: find the fastest size for this buffer
|
|
10
|
+
|
|
11
|
+
constructor(resolution, material, enableUvs, enableColors, enableNormals, volumeFieldRef) {
|
|
12
|
+
const geometry = new BufferGeometry();
|
|
13
|
+
super(geometry, material);
|
|
14
|
+
this.maxCount = 16384; //4096; // TODO: find the fastest size for this buffer
|
|
15
|
+
this.count = 0;
|
|
16
|
+
this.hasPositions = false;
|
|
17
|
+
this.hasNormals = false;
|
|
18
|
+
this.hasColors = false;
|
|
19
|
+
this.hasUvs = false;
|
|
20
|
+
const scope = this;
|
|
21
|
+
|
|
22
|
+
// basic default init; these should be reset later.
|
|
23
|
+
//this.position = new Vector3();
|
|
24
|
+
//this.scale = new Vector3(1, 1, 1);
|
|
25
|
+
this.isovalue = 0;
|
|
26
|
+
|
|
27
|
+
// temp buffers used in polygonize
|
|
28
|
+
|
|
29
|
+
const vlist = new Float32Array(12 * 3);
|
|
30
|
+
const nlist = new Float32Array(12 * 3);
|
|
31
|
+
this.enableUvs = !!enableUvs;
|
|
32
|
+
this.enableColors = !!enableColors;
|
|
33
|
+
this.enableNormals = !!enableNormals;
|
|
34
|
+
this.dirty = true;
|
|
35
|
+
this.resolution = [0, 0, 0];
|
|
36
|
+
this.stepSizeX = 0;
|
|
37
|
+
this.stepSizeY = 0;
|
|
38
|
+
this.stepSizeZ = 0;
|
|
39
|
+
this.sizeX = 0;
|
|
40
|
+
this.sizeY = 0;
|
|
41
|
+
this.sizeZ = 0;
|
|
42
|
+
this.sizeXY = 0;
|
|
43
|
+
this.sizeXYZ = 0;
|
|
44
|
+
this.size3 = 0;
|
|
45
|
+
this.halfsizeX = 0;
|
|
46
|
+
this.halfsizeY = 0;
|
|
47
|
+
this.halfsizeZ = 0;
|
|
48
|
+
this.deltaX = 0;
|
|
49
|
+
this.deltaY = 0;
|
|
50
|
+
this.deltaZ = 0;
|
|
51
|
+
this.yd = 0;
|
|
52
|
+
this.zd = 0;
|
|
53
|
+
this.field = new Uint8Array();
|
|
54
|
+
this.normal_cache = new Float32Array();
|
|
55
|
+
this.positionArray = new Float32Array();
|
|
56
|
+
this.normalArray = new Float32Array();
|
|
57
|
+
this.uvArray = new Float32Array();
|
|
58
|
+
this.colorArray = new Float32Array();
|
|
59
|
+
|
|
60
|
+
// functions have to be object properties
|
|
61
|
+
// prototype functions kill performance
|
|
62
|
+
// (tested and it was 4x slower !!!)
|
|
63
|
+
|
|
64
|
+
this.init = function (resolution, volumeFieldRef) {
|
|
65
|
+
this.dirty = true;
|
|
66
|
+
this.resolution = resolution;
|
|
67
|
+
|
|
68
|
+
// parameters
|
|
69
|
+
|
|
70
|
+
this.isovalue = 0.05;
|
|
71
|
+
this.stepSizeX = 1;
|
|
72
|
+
this.stepSizeY = 1;
|
|
73
|
+
this.stepSizeZ = 1;
|
|
74
|
+
|
|
75
|
+
// size of field, 32 is pushing it in Javascript :)
|
|
76
|
+
this.sizeX = resolution[0];
|
|
77
|
+
this.sizeY = resolution[1];
|
|
78
|
+
this.sizeZ = resolution[2];
|
|
79
|
+
this.sizeXY = this.sizeX * this.sizeY;
|
|
80
|
+
this.sizeXYZ = this.sizeXY * this.sizeZ;
|
|
81
|
+
this.size3 = this.sizeXYZ;
|
|
82
|
+
this.halfsizeX = this.sizeX / 2.0;
|
|
83
|
+
this.halfsizeY = this.sizeY / 2.0;
|
|
84
|
+
this.halfsizeZ = this.sizeZ / 2.0;
|
|
85
|
+
|
|
86
|
+
// deltas
|
|
87
|
+
|
|
88
|
+
this.deltaX = 2.0 / this.sizeX;
|
|
89
|
+
this.deltaY = 2.0 / this.sizeY;
|
|
90
|
+
this.deltaZ = 2.0 / this.sizeZ;
|
|
91
|
+
this.yd = this.sizeX;
|
|
92
|
+
this.zd = this.sizeXY;
|
|
93
|
+
if (volumeFieldRef) {
|
|
94
|
+
this.field = volumeFieldRef;
|
|
95
|
+
} else {
|
|
96
|
+
this.field = new Float32Array(this.size3);
|
|
97
|
+
}
|
|
98
|
+
this.normal_cache = new Float32Array(this.size3 * 3);
|
|
99
|
+
|
|
100
|
+
// immediate render mode simulator
|
|
101
|
+
|
|
102
|
+
this.maxCount = 16384; //4096; // TODO: find the fastest size for this buffer
|
|
103
|
+
this.count = 0;
|
|
104
|
+
this.hasPositions = false;
|
|
105
|
+
this.hasNormals = false;
|
|
106
|
+
this.hasColors = false;
|
|
107
|
+
this.hasUvs = false;
|
|
108
|
+
this.positionArray = new Float32Array(this.maxCount * 3);
|
|
109
|
+
if (this.enableNormals) {
|
|
110
|
+
this.normalArray = new Float32Array(this.maxCount * 3);
|
|
111
|
+
}
|
|
112
|
+
if (this.enableUvs) {
|
|
113
|
+
this.uvArray = new Float32Array(this.maxCount * 2);
|
|
114
|
+
}
|
|
115
|
+
if (this.enableColors) {
|
|
116
|
+
this.colorArray = new Float32Array(this.maxCount * 3);
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
///////////////////////
|
|
121
|
+
// Polygonization
|
|
122
|
+
///////////////////////
|
|
123
|
+
|
|
124
|
+
function lerp(a, b, t) {
|
|
125
|
+
return a + (b - a) * t;
|
|
126
|
+
}
|
|
127
|
+
function VIntX(q, offset, isol, x, y, z, valp1, valp2) {
|
|
128
|
+
const mu = (isol - valp1) / (valp2 - valp1),
|
|
129
|
+
nc = scope.normal_cache;
|
|
130
|
+
vlist[offset + 0] = x + mu * scope.deltaX * scope.stepSizeX;
|
|
131
|
+
vlist[offset + 1] = y;
|
|
132
|
+
vlist[offset + 2] = z;
|
|
133
|
+
nlist[offset + 0] = lerp(nc[q + 0], nc[q + 3], mu);
|
|
134
|
+
nlist[offset + 1] = lerp(nc[q + 1], nc[q + 4], mu);
|
|
135
|
+
nlist[offset + 2] = lerp(nc[q + 2], nc[q + 5], mu);
|
|
136
|
+
}
|
|
137
|
+
function VIntY(q, offset, isol, x, y, z, valp1, valp2) {
|
|
138
|
+
const mu = (isol - valp1) / (valp2 - valp1),
|
|
139
|
+
nc = scope.normal_cache;
|
|
140
|
+
vlist[offset + 0] = x;
|
|
141
|
+
vlist[offset + 1] = y + mu * scope.deltaY * scope.stepSizeY;
|
|
142
|
+
vlist[offset + 2] = z;
|
|
143
|
+
const q2 = q + scope.yd * 3;
|
|
144
|
+
nlist[offset + 0] = lerp(nc[q + 0], nc[q2 + 0], mu);
|
|
145
|
+
nlist[offset + 1] = lerp(nc[q + 1], nc[q2 + 1], mu);
|
|
146
|
+
nlist[offset + 2] = lerp(nc[q + 2], nc[q2 + 2], mu);
|
|
147
|
+
}
|
|
148
|
+
function VIntZ(q, offset, isol, x, y, z, valp1, valp2) {
|
|
149
|
+
const mu = (isol - valp1) / (valp2 - valp1),
|
|
150
|
+
nc = scope.normal_cache;
|
|
151
|
+
vlist[offset + 0] = x;
|
|
152
|
+
vlist[offset + 1] = y;
|
|
153
|
+
vlist[offset + 2] = z + mu * scope.deltaZ * scope.stepSizeZ;
|
|
154
|
+
const q2 = q + scope.zd * 3;
|
|
155
|
+
nlist[offset + 0] = lerp(nc[q + 0], nc[q2 + 0], mu);
|
|
156
|
+
nlist[offset + 1] = lerp(nc[q + 1], nc[q2 + 1], mu);
|
|
157
|
+
nlist[offset + 2] = lerp(nc[q + 2], nc[q2 + 2], mu);
|
|
158
|
+
}
|
|
159
|
+
function compNorm(q) {
|
|
160
|
+
const q3 = q * 3;
|
|
161
|
+
if (scope.normal_cache[q3] === 0.0) {
|
|
162
|
+
scope.normal_cache[q3 + 0] = scope.field[q - 1 * scope.stepSizeX] - scope.field[q + 1 * scope.stepSizeX];
|
|
163
|
+
scope.normal_cache[q3 + 1] = scope.field[q - scope.yd * scope.stepSizeY] - scope.field[q + scope.yd * scope.stepSizeY];
|
|
164
|
+
scope.normal_cache[q3 + 2] = scope.field[q - scope.zd * scope.stepSizeZ] - scope.field[q + scope.zd * scope.stepSizeZ];
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
// Returns total number of triangles. Fills triangles.
|
|
169
|
+
// (this is where most of time is spent - it's inner work of O(n3) loop )
|
|
170
|
+
|
|
171
|
+
function polygonize(fx, fy, fz, q, isol, renderCallback) {
|
|
172
|
+
// cache indices
|
|
173
|
+
const q1 = q + 1 * scope.stepSizeX,
|
|
174
|
+
qy = q + scope.yd * scope.stepSizeY,
|
|
175
|
+
qz = q + scope.zd * scope.stepSizeZ,
|
|
176
|
+
q1y = q1 + scope.yd * scope.stepSizeY,
|
|
177
|
+
q1z = q1 + scope.zd * scope.stepSizeZ,
|
|
178
|
+
qyz = q + scope.yd * scope.stepSizeY + scope.zd * scope.stepSizeZ,
|
|
179
|
+
q1yz = q1 + scope.yd * scope.stepSizeY + scope.zd * scope.stepSizeZ;
|
|
180
|
+
let cubeindex = 0;
|
|
181
|
+
const field0 = scope.field[q],
|
|
182
|
+
field1 = scope.field[q1],
|
|
183
|
+
field2 = scope.field[qy],
|
|
184
|
+
field3 = scope.field[q1y],
|
|
185
|
+
field4 = scope.field[qz],
|
|
186
|
+
field5 = scope.field[q1z],
|
|
187
|
+
field6 = scope.field[qyz],
|
|
188
|
+
field7 = scope.field[q1yz];
|
|
189
|
+
if (field0 < isol) cubeindex |= 1;
|
|
190
|
+
if (field1 < isol) cubeindex |= 2;
|
|
191
|
+
if (field2 < isol) cubeindex |= 8;
|
|
192
|
+
if (field3 < isol) cubeindex |= 4;
|
|
193
|
+
if (field4 < isol) cubeindex |= 16;
|
|
194
|
+
if (field5 < isol) cubeindex |= 32;
|
|
195
|
+
if (field6 < isol) cubeindex |= 128;
|
|
196
|
+
if (field7 < isol) cubeindex |= 64;
|
|
197
|
+
|
|
198
|
+
// if cube is entirely in/out of the surface - bail, nothing to draw
|
|
199
|
+
|
|
200
|
+
const bits = edgeTable[cubeindex];
|
|
201
|
+
if (bits === 0) return 0;
|
|
202
|
+
const dx = scope.deltaX * scope.stepSizeX,
|
|
203
|
+
dy = scope.deltaY * scope.stepSizeY,
|
|
204
|
+
dz = scope.deltaZ * scope.stepSizeZ,
|
|
205
|
+
fx2 = fx + dx,
|
|
206
|
+
fy2 = fy + dy,
|
|
207
|
+
fz2 = fz + dz;
|
|
208
|
+
|
|
209
|
+
// top of the cube
|
|
210
|
+
|
|
211
|
+
if (bits & 1) {
|
|
212
|
+
compNorm(q);
|
|
213
|
+
compNorm(q1);
|
|
214
|
+
VIntX(q * 3, 0, isol, fx, fy, fz, field0, field1);
|
|
215
|
+
}
|
|
216
|
+
if (bits & 2) {
|
|
217
|
+
compNorm(q1);
|
|
218
|
+
compNorm(q1y);
|
|
219
|
+
VIntY(q1 * 3, 3, isol, fx2, fy, fz, field1, field3);
|
|
220
|
+
}
|
|
221
|
+
if (bits & 4) {
|
|
222
|
+
compNorm(qy);
|
|
223
|
+
compNorm(q1y);
|
|
224
|
+
VIntX(qy * 3, 6, isol, fx, fy2, fz, field2, field3);
|
|
225
|
+
}
|
|
226
|
+
if (bits & 8) {
|
|
227
|
+
compNorm(q);
|
|
228
|
+
compNorm(qy);
|
|
229
|
+
VIntY(q * 3, 9, isol, fx, fy, fz, field0, field2);
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
// bottom of the cube
|
|
233
|
+
|
|
234
|
+
if (bits & 16) {
|
|
235
|
+
compNorm(qz);
|
|
236
|
+
compNorm(q1z);
|
|
237
|
+
VIntX(qz * 3, 12, isol, fx, fy, fz2, field4, field5);
|
|
238
|
+
}
|
|
239
|
+
if (bits & 32) {
|
|
240
|
+
compNorm(q1z);
|
|
241
|
+
compNorm(q1yz);
|
|
242
|
+
VIntY(q1z * 3, 15, isol, fx2, fy, fz2, field5, field7);
|
|
243
|
+
}
|
|
244
|
+
if (bits & 64) {
|
|
245
|
+
compNorm(qyz);
|
|
246
|
+
compNorm(q1yz);
|
|
247
|
+
VIntX(qyz * 3, 18, isol, fx, fy2, fz2, field6, field7);
|
|
248
|
+
}
|
|
249
|
+
if (bits & 128) {
|
|
250
|
+
compNorm(qz);
|
|
251
|
+
compNorm(qyz);
|
|
252
|
+
VIntY(qz * 3, 21, isol, fx, fy, fz2, field4, field6);
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
// vertical lines of the cube
|
|
256
|
+
|
|
257
|
+
if (bits & 256) {
|
|
258
|
+
compNorm(q);
|
|
259
|
+
compNorm(qz);
|
|
260
|
+
VIntZ(q * 3, 24, isol, fx, fy, fz, field0, field4);
|
|
261
|
+
}
|
|
262
|
+
if (bits & 512) {
|
|
263
|
+
compNorm(q1);
|
|
264
|
+
compNorm(q1z);
|
|
265
|
+
VIntZ(q1 * 3, 27, isol, fx2, fy, fz, field1, field5);
|
|
266
|
+
}
|
|
267
|
+
if (bits & 1024) {
|
|
268
|
+
compNorm(q1y);
|
|
269
|
+
compNorm(q1yz);
|
|
270
|
+
VIntZ(q1y * 3, 30, isol, fx2, fy2, fz, field3, field7);
|
|
271
|
+
}
|
|
272
|
+
if (bits & 2048) {
|
|
273
|
+
compNorm(qy);
|
|
274
|
+
compNorm(qyz);
|
|
275
|
+
VIntZ(qy * 3, 33, isol, fx, fy2, fz, field2, field6);
|
|
276
|
+
}
|
|
277
|
+
cubeindex <<= 4; // re-purpose cubeindex into an offset into triTable
|
|
278
|
+
|
|
279
|
+
let o1,
|
|
280
|
+
o2,
|
|
281
|
+
o3,
|
|
282
|
+
numtris = 0,
|
|
283
|
+
i = 0;
|
|
284
|
+
|
|
285
|
+
// here is where triangles are created
|
|
286
|
+
|
|
287
|
+
while (triTable[cubeindex + i] != -1) {
|
|
288
|
+
o1 = cubeindex + i;
|
|
289
|
+
o2 = o1 + 1;
|
|
290
|
+
o3 = o1 + 2;
|
|
291
|
+
posnormtriv(vlist, nlist, 3 * triTable[o1], 3 * triTable[o2], 3 * triTable[o3], renderCallback);
|
|
292
|
+
i += 3;
|
|
293
|
+
numtris++;
|
|
294
|
+
}
|
|
295
|
+
return numtris;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
/////////////////////////////////////
|
|
299
|
+
// Immediate render mode simulator
|
|
300
|
+
/////////////////////////////////////
|
|
301
|
+
|
|
302
|
+
function posnormtriv(pos, norm, o1, o2, o3, renderCallback) {
|
|
303
|
+
const c = scope.count * 3;
|
|
304
|
+
|
|
305
|
+
// positions
|
|
306
|
+
|
|
307
|
+
scope.positionArray[c + 0] = pos[o1];
|
|
308
|
+
scope.positionArray[c + 1] = pos[o1 + 1];
|
|
309
|
+
scope.positionArray[c + 2] = pos[o1 + 2];
|
|
310
|
+
scope.positionArray[c + 3] = pos[o2];
|
|
311
|
+
scope.positionArray[c + 4] = pos[o2 + 1];
|
|
312
|
+
scope.positionArray[c + 5] = pos[o2 + 2];
|
|
313
|
+
scope.positionArray[c + 6] = pos[o3];
|
|
314
|
+
scope.positionArray[c + 7] = pos[o3 + 1];
|
|
315
|
+
scope.positionArray[c + 8] = pos[o3 + 2];
|
|
316
|
+
|
|
317
|
+
// normals
|
|
318
|
+
|
|
319
|
+
if (scope.enableNormals) {
|
|
320
|
+
scope.normalArray[c + 0] = norm[o1];
|
|
321
|
+
scope.normalArray[c + 1] = norm[o1 + 1];
|
|
322
|
+
scope.normalArray[c + 2] = norm[o1 + 2];
|
|
323
|
+
scope.normalArray[c + 3] = norm[o2];
|
|
324
|
+
scope.normalArray[c + 4] = norm[o2 + 1];
|
|
325
|
+
scope.normalArray[c + 5] = norm[o2 + 2];
|
|
326
|
+
scope.normalArray[c + 6] = norm[o3];
|
|
327
|
+
scope.normalArray[c + 7] = norm[o3 + 1];
|
|
328
|
+
scope.normalArray[c + 8] = norm[o3 + 2];
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
// uvs
|
|
332
|
+
|
|
333
|
+
if (scope.enableUvs) {
|
|
334
|
+
const d = scope.count * 2;
|
|
335
|
+
scope.uvArray[d + 0] = pos[o1];
|
|
336
|
+
scope.uvArray[d + 1] = pos[o1 + 2];
|
|
337
|
+
scope.uvArray[d + 2] = pos[o2];
|
|
338
|
+
scope.uvArray[d + 3] = pos[o2 + 2];
|
|
339
|
+
scope.uvArray[d + 4] = pos[o3];
|
|
340
|
+
scope.uvArray[d + 5] = pos[o3 + 2];
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
// colors
|
|
344
|
+
|
|
345
|
+
if (scope.enableColors) {
|
|
346
|
+
scope.colorArray[c + 0] = pos[o1];
|
|
347
|
+
scope.colorArray[c + 1] = pos[o1 + 1];
|
|
348
|
+
scope.colorArray[c + 2] = pos[o1 + 2];
|
|
349
|
+
scope.colorArray[c + 3] = pos[o2];
|
|
350
|
+
scope.colorArray[c + 4] = pos[o2 + 1];
|
|
351
|
+
scope.colorArray[c + 5] = pos[o2 + 2];
|
|
352
|
+
scope.colorArray[c + 6] = pos[o3];
|
|
353
|
+
scope.colorArray[c + 7] = pos[o3 + 1];
|
|
354
|
+
scope.colorArray[c + 8] = pos[o3 + 2];
|
|
355
|
+
}
|
|
356
|
+
scope.count += 3;
|
|
357
|
+
if (scope.count >= scope.maxCount - 3) {
|
|
358
|
+
scope.hasPositions = true;
|
|
359
|
+
if (scope.enableNormals) {
|
|
360
|
+
scope.hasNormals = true;
|
|
361
|
+
}
|
|
362
|
+
if (scope.enableUvs) {
|
|
363
|
+
scope.hasUvs = true;
|
|
364
|
+
}
|
|
365
|
+
if (scope.enableColors) {
|
|
366
|
+
scope.hasColors = true;
|
|
367
|
+
}
|
|
368
|
+
renderCallback(scope);
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
this.begin = function () {
|
|
372
|
+
this.count = 0;
|
|
373
|
+
this.hasPositions = false;
|
|
374
|
+
this.hasNormals = false;
|
|
375
|
+
this.hasUvs = false;
|
|
376
|
+
this.hasColors = false;
|
|
377
|
+
};
|
|
378
|
+
this.end = function (renderCallback) {
|
|
379
|
+
if (this.count === 0) return;
|
|
380
|
+
for (let i = this.count * 3; i < this.positionArray.length; i++) {
|
|
381
|
+
this.positionArray[i] = 0.0;
|
|
382
|
+
}
|
|
383
|
+
this.hasPositions = true;
|
|
384
|
+
if (this.enableNormals) {
|
|
385
|
+
this.hasNormals = true;
|
|
386
|
+
}
|
|
387
|
+
if (this.enableUvs) {
|
|
388
|
+
this.hasUvs = true;
|
|
389
|
+
}
|
|
390
|
+
if (this.enableColors) {
|
|
391
|
+
this.hasColors = true;
|
|
392
|
+
}
|
|
393
|
+
renderCallback(this);
|
|
394
|
+
};
|
|
395
|
+
|
|
396
|
+
/////////////////////////////////////
|
|
397
|
+
// Updates
|
|
398
|
+
/////////////////////////////////////
|
|
399
|
+
|
|
400
|
+
this.reset = function () {
|
|
401
|
+
var i;
|
|
402
|
+
|
|
403
|
+
// wipe the normal cache
|
|
404
|
+
|
|
405
|
+
for (i = 0; i < this.size3; i++) {
|
|
406
|
+
this.normal_cache[i * 3] = 0.0;
|
|
407
|
+
this.field[i] = 0.0;
|
|
408
|
+
}
|
|
409
|
+
};
|
|
410
|
+
this.render = function (renderCallback) {
|
|
411
|
+
if (!this.dirty) {
|
|
412
|
+
this.end(renderCallback);
|
|
413
|
+
return;
|
|
414
|
+
}
|
|
415
|
+
this.begin();
|
|
416
|
+
|
|
417
|
+
// Triangulate. Yeah, this is slow.
|
|
418
|
+
|
|
419
|
+
const smin2x = this.sizeX - 2;
|
|
420
|
+
const smin2y = this.sizeY - 2;
|
|
421
|
+
const smin2z = this.sizeZ - 2;
|
|
422
|
+
for (let z = 1; z < smin2z; z += this.stepSizeZ) {
|
|
423
|
+
const z_offset = this.sizeXY * z;
|
|
424
|
+
const fz = (z - this.halfsizeZ) / this.halfsizeZ; //+ 1
|
|
425
|
+
|
|
426
|
+
for (let y = 1; y < smin2y; y += this.stepSizeY) {
|
|
427
|
+
const y_offset = z_offset + this.sizeX * y;
|
|
428
|
+
const fy = (y - this.halfsizeY) / this.halfsizeY; //+ 1
|
|
429
|
+
|
|
430
|
+
for (let x = 1; x < smin2x; x += this.stepSizeX) {
|
|
431
|
+
const fx = (x - this.halfsizeX) / this.halfsizeX; //+ 1
|
|
432
|
+
const q = y_offset + x;
|
|
433
|
+
polygonize(fx, fy, fz, q, this.isovalue, renderCallback);
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
this.end(renderCallback);
|
|
438
|
+
};
|
|
439
|
+
this.generateGeometry = function () {
|
|
440
|
+
if (!this.dirty) {
|
|
441
|
+
return;
|
|
442
|
+
}
|
|
443
|
+
let start = 0;
|
|
444
|
+
const geoparent = [];
|
|
445
|
+
//var normals = [];
|
|
446
|
+
|
|
447
|
+
const geo_callback = function (object) {
|
|
448
|
+
const geo = new BufferGeometry();
|
|
449
|
+
geo.setAttribute("position", new BufferAttribute(object.positionArray.slice(), 3));
|
|
450
|
+
if (object.enableNormals) {
|
|
451
|
+
geo.setAttribute("normal", new BufferAttribute(object.normalArray.slice(), 3));
|
|
452
|
+
}
|
|
453
|
+
// for ( var i = 0; i < object.count; i ++ ) {
|
|
454
|
+
//
|
|
455
|
+
// var vertex = new Vector3().fromArray( object.positionArray, i * 3 );
|
|
456
|
+
// var normal = new Vector3().fromArray( object.normalArray, i * 3 );
|
|
457
|
+
//
|
|
458
|
+
// geo.vertices.push( vertex );
|
|
459
|
+
// normals.push( normal );
|
|
460
|
+
//
|
|
461
|
+
// }
|
|
462
|
+
|
|
463
|
+
const inds = new Uint16Array(object.count);
|
|
464
|
+
const nfaces = object.count / 3;
|
|
465
|
+
for (let i = 0; i < nfaces; i++) {
|
|
466
|
+
const a = /* start + */i * 3;
|
|
467
|
+
const b = a + 1;
|
|
468
|
+
const c = a + 2;
|
|
469
|
+
inds[i * 3 + 0] = a;
|
|
470
|
+
inds[i * 3 + 1] = b;
|
|
471
|
+
inds[i * 3 + 2] = c;
|
|
472
|
+
|
|
473
|
+
// var na = normals[ a ];
|
|
474
|
+
// var nb = normals[ b ];
|
|
475
|
+
// var nc = normals[ c ];
|
|
476
|
+
//
|
|
477
|
+
// var face = new Face3( a, b, c, [ na, nb, nc ] );
|
|
478
|
+
// geo.faces.push( face );
|
|
479
|
+
}
|
|
480
|
+
geo.setIndex(new BufferAttribute(inds, 1));
|
|
481
|
+
geoparent.push(geo);
|
|
482
|
+
start += nfaces;
|
|
483
|
+
object.count = 0;
|
|
484
|
+
};
|
|
485
|
+
this.render(geo_callback);
|
|
486
|
+
|
|
487
|
+
// console.log( "generated " + geo.faces.length + " triangles" );
|
|
488
|
+
|
|
489
|
+
this.dirty = false;
|
|
490
|
+
return geoparent;
|
|
491
|
+
};
|
|
492
|
+
this.init(resolution, volumeFieldRef);
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
/////////////////////////////////////
|
|
497
|
+
// Marching cubes lookup tables
|
|
498
|
+
/////////////////////////////////////
|
|
499
|
+
|
|
500
|
+
// These tables are straight from Paul Bourke's page:
|
|
501
|
+
// http://local.wasp.uwa.edu.au/~pbourke/geometry/polygonise/
|
|
502
|
+
// who in turn got them from Cory Gene Bloyd.
|
|
503
|
+
|
|
504
|
+
const edgeTable = new Int32Array([0x0, 0x109, 0x203, 0x30a, 0x406, 0x50f, 0x605, 0x70c, 0x80c, 0x905, 0xa0f, 0xb06, 0xc0a, 0xd03, 0xe09, 0xf00, 0x190, 0x99, 0x393, 0x29a, 0x596, 0x49f, 0x795, 0x69c, 0x99c, 0x895, 0xb9f, 0xa96, 0xd9a, 0xc93, 0xf99, 0xe90, 0x230, 0x339, 0x33, 0x13a, 0x636, 0x73f, 0x435, 0x53c, 0xa3c, 0xb35, 0x83f, 0x936, 0xe3a, 0xf33, 0xc39, 0xd30, 0x3a0, 0x2a9, 0x1a3, 0xaa, 0x7a6, 0x6af, 0x5a5, 0x4ac, 0xbac, 0xaa5, 0x9af, 0x8a6, 0xfaa, 0xea3, 0xda9, 0xca0, 0x460, 0x569, 0x663, 0x76a, 0x66, 0x16f, 0x265, 0x36c, 0xc6c, 0xd65, 0xe6f, 0xf66, 0x86a, 0x963, 0xa69, 0xb60, 0x5f0, 0x4f9, 0x7f3, 0x6fa, 0x1f6, 0xff, 0x3f5, 0x2fc, 0xdfc, 0xcf5, 0xfff, 0xef6, 0x9fa, 0x8f3, 0xbf9, 0xaf0, 0x650, 0x759, 0x453, 0x55a, 0x256, 0x35f, 0x55, 0x15c, 0xe5c, 0xf55, 0xc5f, 0xd56, 0xa5a, 0xb53, 0x859, 0x950, 0x7c0, 0x6c9, 0x5c3, 0x4ca, 0x3c6, 0x2cf, 0x1c5, 0xcc, 0xfcc, 0xec5, 0xdcf, 0xcc6, 0xbca, 0xac3, 0x9c9, 0x8c0, 0x8c0, 0x9c9, 0xac3, 0xbca, 0xcc6, 0xdcf, 0xec5, 0xfcc, 0xcc, 0x1c5, 0x2cf, 0x3c6, 0x4ca, 0x5c3, 0x6c9, 0x7c0, 0x950, 0x859, 0xb53, 0xa5a, 0xd56, 0xc5f, 0xf55, 0xe5c, 0x15c, 0x55, 0x35f, 0x256, 0x55a, 0x453, 0x759, 0x650, 0xaf0, 0xbf9, 0x8f3, 0x9fa, 0xef6, 0xfff, 0xcf5, 0xdfc, 0x2fc, 0x3f5, 0xff, 0x1f6, 0x6fa, 0x7f3, 0x4f9, 0x5f0, 0xb60, 0xa69, 0x963, 0x86a, 0xf66, 0xe6f, 0xd65, 0xc6c, 0x36c, 0x265, 0x16f, 0x66, 0x76a, 0x663, 0x569, 0x460, 0xca0, 0xda9, 0xea3, 0xfaa, 0x8a6, 0x9af, 0xaa5, 0xbac, 0x4ac, 0x5a5, 0x6af, 0x7a6, 0xaa, 0x1a3, 0x2a9, 0x3a0, 0xd30, 0xc39, 0xf33, 0xe3a, 0x936, 0x83f, 0xb35, 0xa3c, 0x53c, 0x435, 0x73f, 0x636, 0x13a, 0x33, 0x339, 0x230, 0xe90, 0xf99, 0xc93, 0xd9a, 0xa96, 0xb9f, 0x895, 0x99c, 0x69c, 0x795, 0x49f, 0x596, 0x29a, 0x393, 0x99, 0x190, 0xf00, 0xe09, 0xd03, 0xc0a, 0xb06, 0xa0f, 0x905, 0x80c, 0x70c, 0x605, 0x50f, 0x406, 0x30a, 0x203, 0x109, 0x0]);
|
|
505
|
+
const triTable = new Int32Array([-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 8, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 1, 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 8, 3, 9, 8, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 2, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 8, 3, 1, 2, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 9, 2, 10, 0, 2, 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 2, 8, 3, 2, 10, 8, 10, 9, 8, -1, -1, -1, -1, -1, -1, -1, 3, 11, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 11, 2, 8, 11, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 9, 0, 2, 3, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 11, 2, 1, 9, 11, 9, 8, 11, -1, -1, -1, -1, -1, -1, -1, 3, 10, 1, 11, 10, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 10, 1, 0, 8, 10, 8, 11, 10, -1, -1, -1, -1, -1, -1, -1, 3, 9, 0, 3, 11, 9, 11, 10, 9, -1, -1, -1, -1, -1, -1, -1, 9, 8, 10, 10, 8, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 4, 7, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 4, 3, 0, 7, 3, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 1, 9, 8, 4, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 4, 1, 9, 4, 7, 1, 7, 3, 1, -1, -1, -1, -1, -1, -1, -1, 1, 2, 10, 8, 4, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 3, 4, 7, 3, 0, 4, 1, 2, 10, -1, -1, -1, -1, -1, -1, -1, 9, 2, 10, 9, 0, 2, 8, 4, 7, -1, -1, -1, -1, -1, -1, -1, 2, 10, 9, 2, 9, 7, 2, 7, 3, 7, 9, 4, -1, -1, -1, -1, 8, 4, 7, 3, 11, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 11, 4, 7, 11, 2, 4, 2, 0, 4, -1, -1, -1, -1, -1, -1, -1, 9, 0, 1, 8, 4, 7, 2, 3, 11, -1, -1, -1, -1, -1, -1, -1, 4, 7, 11, 9, 4, 11, 9, 11, 2, 9, 2, 1, -1, -1, -1, -1, 3, 10, 1, 3, 11, 10, 7, 8, 4, -1, -1, -1, -1, -1, -1, -1, 1, 11, 10, 1, 4, 11, 1, 0, 4, 7, 11, 4, -1, -1, -1, -1, 4, 7, 8, 9, 0, 11, 9, 11, 10, 11, 0, 3, -1, -1, -1, -1, 4, 7, 11, 4, 11, 9, 9, 11, 10, -1, -1, -1, -1, -1, -1, -1, 9, 5, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 9, 5, 4, 0, 8, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 5, 4, 1, 5, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 8, 5, 4, 8, 3, 5, 3, 1, 5, -1, -1, -1, -1, -1, -1, -1, 1, 2, 10, 9, 5, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 3, 0, 8, 1, 2, 10, 4, 9, 5, -1, -1, -1, -1, -1, -1, -1, 5, 2, 10, 5, 4, 2, 4, 0, 2, -1, -1, -1, -1, -1, -1, -1, 2, 10, 5, 3, 2, 5, 3, 5, 4, 3, 4, 8, -1, -1, -1, -1, 9, 5, 4, 2, 3, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 11, 2, 0, 8, 11, 4, 9, 5, -1, -1, -1, -1, -1, -1, -1, 0, 5, 4, 0, 1, 5, 2, 3, 11, -1, -1, -1, -1, -1, -1, -1, 2, 1, 5, 2, 5, 8, 2, 8, 11, 4, 8, 5, -1, -1, -1, -1, 10, 3, 11, 10, 1, 3, 9, 5, 4, -1, -1, -1, -1, -1, -1, -1, 4, 9, 5, 0, 8, 1, 8, 10, 1, 8, 11, 10, -1, -1, -1, -1, 5, 4, 0, 5, 0, 11, 5, 11, 10, 11, 0, 3, -1, -1, -1, -1, 5, 4, 8, 5, 8, 10, 10, 8, 11, -1, -1, -1, -1, -1, -1, -1, 9, 7, 8, 5, 7, 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 9, 3, 0, 9, 5, 3, 5, 7, 3, -1, -1, -1, -1, -1, -1, -1, 0, 7, 8, 0, 1, 7, 1, 5, 7, -1, -1, -1, -1, -1, -1, -1, 1, 5, 3, 3, 5, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 9, 7, 8, 9, 5, 7, 10, 1, 2, -1, -1, -1, -1, -1, -1, -1, 10, 1, 2, 9, 5, 0, 5, 3, 0, 5, 7, 3, -1, -1, -1, -1, 8, 0, 2, 8, 2, 5, 8, 5, 7, 10, 5, 2, -1, -1, -1, -1, 2, 10, 5, 2, 5, 3, 3, 5, 7, -1, -1, -1, -1, -1, -1, -1, 7, 9, 5, 7, 8, 9, 3, 11, 2, -1, -1, -1, -1, -1, -1, -1, 9, 5, 7, 9, 7, 2, 9, 2, 0, 2, 7, 11, -1, -1, -1, -1, 2, 3, 11, 0, 1, 8, 1, 7, 8, 1, 5, 7, -1, -1, -1, -1, 11, 2, 1, 11, 1, 7, 7, 1, 5, -1, -1, -1, -1, -1, -1, -1, 9, 5, 8, 8, 5, 7, 10, 1, 3, 10, 3, 11, -1, -1, -1, -1, 5, 7, 0, 5, 0, 9, 7, 11, 0, 1, 0, 10, 11, 10, 0, -1, 11, 10, 0, 11, 0, 3, 10, 5, 0, 8, 0, 7, 5, 7, 0, -1, 11, 10, 5, 7, 11, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 10, 6, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 8, 3, 5, 10, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 9, 0, 1, 5, 10, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 8, 3, 1, 9, 8, 5, 10, 6, -1, -1, -1, -1, -1, -1, -1, 1, 6, 5, 2, 6, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 6, 5, 1, 2, 6, 3, 0, 8, -1, -1, -1, -1, -1, -1, -1, 9, 6, 5, 9, 0, 6, 0, 2, 6, -1, -1, -1, -1, -1, -1, -1, 5, 9, 8, 5, 8, 2, 5, 2, 6, 3, 2, 8, -1, -1, -1, -1, 2, 3, 11, 10, 6, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 11, 0, 8, 11, 2, 0, 10, 6, 5, -1, -1, -1, -1, -1, -1, -1, 0, 1, 9, 2, 3, 11, 5, 10, 6, -1, -1, -1, -1, -1, -1, -1, 5, 10, 6, 1, 9, 2, 9, 11, 2, 9, 8, 11, -1, -1, -1, -1, 6, 3, 11, 6, 5, 3, 5, 1, 3, -1, -1, -1, -1, -1, -1, -1, 0, 8, 11, 0, 11, 5, 0, 5, 1, 5, 11, 6, -1, -1, -1, -1, 3, 11, 6, 0, 3, 6, 0, 6, 5, 0, 5, 9, -1, -1, -1, -1, 6, 5, 9, 6, 9, 11, 11, 9, 8, -1, -1, -1, -1, -1, -1, -1, 5, 10, 6, 4, 7, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 4, 3, 0, 4, 7, 3, 6, 5, 10, -1, -1, -1, -1, -1, -1, -1, 1, 9, 0, 5, 10, 6, 8, 4, 7, -1, -1, -1, -1, -1, -1, -1, 10, 6, 5, 1, 9, 7, 1, 7, 3, 7, 9, 4, -1, -1, -1, -1, 6, 1, 2, 6, 5, 1, 4, 7, 8, -1, -1, -1, -1, -1, -1, -1, 1, 2, 5, 5, 2, 6, 3, 0, 4, 3, 4, 7, -1, -1, -1, -1, 8, 4, 7, 9, 0, 5, 0, 6, 5, 0, 2, 6, -1, -1, -1, -1, 7, 3, 9, 7, 9, 4, 3, 2, 9, 5, 9, 6, 2, 6, 9, -1, 3, 11, 2, 7, 8, 4, 10, 6, 5, -1, -1, -1, -1, -1, -1, -1, 5, 10, 6, 4, 7, 2, 4, 2, 0, 2, 7, 11, -1, -1, -1, -1, 0, 1, 9, 4, 7, 8, 2, 3, 11, 5, 10, 6, -1, -1, -1, -1, 9, 2, 1, 9, 11, 2, 9, 4, 11, 7, 11, 4, 5, 10, 6, -1, 8, 4, 7, 3, 11, 5, 3, 5, 1, 5, 11, 6, -1, -1, -1, -1, 5, 1, 11, 5, 11, 6, 1, 0, 11, 7, 11, 4, 0, 4, 11, -1, 0, 5, 9, 0, 6, 5, 0, 3, 6, 11, 6, 3, 8, 4, 7, -1, 6, 5, 9, 6, 9, 11, 4, 7, 9, 7, 11, 9, -1, -1, -1, -1, 10, 4, 9, 6, 4, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 4, 10, 6, 4, 9, 10, 0, 8, 3, -1, -1, -1, -1, -1, -1, -1, 10, 0, 1, 10, 6, 0, 6, 4, 0, -1, -1, -1, -1, -1, -1, -1, 8, 3, 1, 8, 1, 6, 8, 6, 4, 6, 1, 10, -1, -1, -1, -1, 1, 4, 9, 1, 2, 4, 2, 6, 4, -1, -1, -1, -1, -1, -1, -1, 3, 0, 8, 1, 2, 9, 2, 4, 9, 2, 6, 4, -1, -1, -1, -1, 0, 2, 4, 4, 2, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 8, 3, 2, 8, 2, 4, 4, 2, 6, -1, -1, -1, -1, -1, -1, -1, 10, 4, 9, 10, 6, 4, 11, 2, 3, -1, -1, -1, -1, -1, -1, -1, 0, 8, 2, 2, 8, 11, 4, 9, 10, 4, 10, 6, -1, -1, -1, -1, 3, 11, 2, 0, 1, 6, 0, 6, 4, 6, 1, 10, -1, -1, -1, -1, 6, 4, 1, 6, 1, 10, 4, 8, 1, 2, 1, 11, 8, 11, 1, -1, 9, 6, 4, 9, 3, 6, 9, 1, 3, 11, 6, 3, -1, -1, -1, -1, 8, 11, 1, 8, 1, 0, 11, 6, 1, 9, 1, 4, 6, 4, 1, -1, 3, 11, 6, 3, 6, 0, 0, 6, 4, -1, -1, -1, -1, -1, -1, -1, 6, 4, 8, 11, 6, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 7, 10, 6, 7, 8, 10, 8, 9, 10, -1, -1, -1, -1, -1, -1, -1, 0, 7, 3, 0, 10, 7, 0, 9, 10, 6, 7, 10, -1, -1, -1, -1, 10, 6, 7, 1, 10, 7, 1, 7, 8, 1, 8, 0, -1, -1, -1, -1, 10, 6, 7, 10, 7, 1, 1, 7, 3, -1, -1, -1, -1, -1, -1, -1, 1, 2, 6, 1, 6, 8, 1, 8, 9, 8, 6, 7, -1, -1, -1, -1, 2, 6, 9, 2, 9, 1, 6, 7, 9, 0, 9, 3, 7, 3, 9, -1, 7, 8, 0, 7, 0, 6, 6, 0, 2, -1, -1, -1, -1, -1, -1, -1, 7, 3, 2, 6, 7, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 2, 3, 11, 10, 6, 8, 10, 8, 9, 8, 6, 7, -1, -1, -1, -1, 2, 0, 7, 2, 7, 11, 0, 9, 7, 6, 7, 10, 9, 10, 7, -1, 1, 8, 0, 1, 7, 8, 1, 10, 7, 6, 7, 10, 2, 3, 11, -1, 11, 2, 1, 11, 1, 7, 10, 6, 1, 6, 7, 1, -1, -1, -1, -1, 8, 9, 6, 8, 6, 7, 9, 1, 6, 11, 6, 3, 1, 3, 6, -1, 0, 9, 1, 11, 6, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 7, 8, 0, 7, 0, 6, 3, 11, 0, 11, 6, 0, -1, -1, -1, -1, 7, 11, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 7, 6, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 3, 0, 8, 11, 7, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 1, 9, 11, 7, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 8, 1, 9, 8, 3, 1, 11, 7, 6, -1, -1, -1, -1, -1, -1, -1, 10, 1, 2, 6, 11, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 2, 10, 3, 0, 8, 6, 11, 7, -1, -1, -1, -1, -1, -1, -1, 2, 9, 0, 2, 10, 9, 6, 11, 7, -1, -1, -1, -1, -1, -1, -1, 6, 11, 7, 2, 10, 3, 10, 8, 3, 10, 9, 8, -1, -1, -1, -1, 7, 2, 3, 6, 2, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 7, 0, 8, 7, 6, 0, 6, 2, 0, -1, -1, -1, -1, -1, -1, -1, 2, 7, 6, 2, 3, 7, 0, 1, 9, -1, -1, -1, -1, -1, -1, -1, 1, 6, 2, 1, 8, 6, 1, 9, 8, 8, 7, 6, -1, -1, -1, -1, 10, 7, 6, 10, 1, 7, 1, 3, 7, -1, -1, -1, -1, -1, -1, -1, 10, 7, 6, 1, 7, 10, 1, 8, 7, 1, 0, 8, -1, -1, -1, -1, 0, 3, 7, 0, 7, 10, 0, 10, 9, 6, 10, 7, -1, -1, -1, -1, 7, 6, 10, 7, 10, 8, 8, 10, 9, -1, -1, -1, -1, -1, -1, -1, 6, 8, 4, 11, 8, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 3, 6, 11, 3, 0, 6, 0, 4, 6, -1, -1, -1, -1, -1, -1, -1, 8, 6, 11, 8, 4, 6, 9, 0, 1, -1, -1, -1, -1, -1, -1, -1, 9, 4, 6, 9, 6, 3, 9, 3, 1, 11, 3, 6, -1, -1, -1, -1, 6, 8, 4, 6, 11, 8, 2, 10, 1, -1, -1, -1, -1, -1, -1, -1, 1, 2, 10, 3, 0, 11, 0, 6, 11, 0, 4, 6, -1, -1, -1, -1, 4, 11, 8, 4, 6, 11, 0, 2, 9, 2, 10, 9, -1, -1, -1, -1, 10, 9, 3, 10, 3, 2, 9, 4, 3, 11, 3, 6, 4, 6, 3, -1, 8, 2, 3, 8, 4, 2, 4, 6, 2, -1, -1, -1, -1, -1, -1, -1, 0, 4, 2, 4, 6, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 9, 0, 2, 3, 4, 2, 4, 6, 4, 3, 8, -1, -1, -1, -1, 1, 9, 4, 1, 4, 2, 2, 4, 6, -1, -1, -1, -1, -1, -1, -1, 8, 1, 3, 8, 6, 1, 8, 4, 6, 6, 10, 1, -1, -1, -1, -1, 10, 1, 0, 10, 0, 6, 6, 0, 4, -1, -1, -1, -1, -1, -1, -1, 4, 6, 3, 4, 3, 8, 6, 10, 3, 0, 3, 9, 10, 9, 3, -1, 10, 9, 4, 6, 10, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 4, 9, 5, 7, 6, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 8, 3, 4, 9, 5, 11, 7, 6, -1, -1, -1, -1, -1, -1, -1, 5, 0, 1, 5, 4, 0, 7, 6, 11, -1, -1, -1, -1, -1, -1, -1, 11, 7, 6, 8, 3, 4, 3, 5, 4, 3, 1, 5, -1, -1, -1, -1, 9, 5, 4, 10, 1, 2, 7, 6, 11, -1, -1, -1, -1, -1, -1, -1, 6, 11, 7, 1, 2, 10, 0, 8, 3, 4, 9, 5, -1, -1, -1, -1, 7, 6, 11, 5, 4, 10, 4, 2, 10, 4, 0, 2, -1, -1, -1, -1, 3, 4, 8, 3, 5, 4, 3, 2, 5, 10, 5, 2, 11, 7, 6, -1, 7, 2, 3, 7, 6, 2, 5, 4, 9, -1, -1, -1, -1, -1, -1, -1, 9, 5, 4, 0, 8, 6, 0, 6, 2, 6, 8, 7, -1, -1, -1, -1, 3, 6, 2, 3, 7, 6, 1, 5, 0, 5, 4, 0, -1, -1, -1, -1, 6, 2, 8, 6, 8, 7, 2, 1, 8, 4, 8, 5, 1, 5, 8, -1, 9, 5, 4, 10, 1, 6, 1, 7, 6, 1, 3, 7, -1, -1, -1, -1, 1, 6, 10, 1, 7, 6, 1, 0, 7, 8, 7, 0, 9, 5, 4, -1, 4, 0, 10, 4, 10, 5, 0, 3, 10, 6, 10, 7, 3, 7, 10, -1, 7, 6, 10, 7, 10, 8, 5, 4, 10, 4, 8, 10, -1, -1, -1, -1, 6, 9, 5, 6, 11, 9, 11, 8, 9, -1, -1, -1, -1, -1, -1, -1, 3, 6, 11, 0, 6, 3, 0, 5, 6, 0, 9, 5, -1, -1, -1, -1, 0, 11, 8, 0, 5, 11, 0, 1, 5, 5, 6, 11, -1, -1, -1, -1, 6, 11, 3, 6, 3, 5, 5, 3, 1, -1, -1, -1, -1, -1, -1, -1, 1, 2, 10, 9, 5, 11, 9, 11, 8, 11, 5, 6, -1, -1, -1, -1, 0, 11, 3, 0, 6, 11, 0, 9, 6, 5, 6, 9, 1, 2, 10, -1, 11, 8, 5, 11, 5, 6, 8, 0, 5, 10, 5, 2, 0, 2, 5, -1, 6, 11, 3, 6, 3, 5, 2, 10, 3, 10, 5, 3, -1, -1, -1, -1, 5, 8, 9, 5, 2, 8, 5, 6, 2, 3, 8, 2, -1, -1, -1, -1, 9, 5, 6, 9, 6, 0, 0, 6, 2, -1, -1, -1, -1, -1, -1, -1, 1, 5, 8, 1, 8, 0, 5, 6, 8, 3, 8, 2, 6, 2, 8, -1, 1, 5, 6, 2, 1, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 3, 6, 1, 6, 10, 3, 8, 6, 5, 6, 9, 8, 9, 6, -1, 10, 1, 0, 10, 0, 6, 9, 5, 0, 5, 6, 0, -1, -1, -1, -1, 0, 3, 8, 5, 6, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 10, 5, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 11, 5, 10, 7, 5, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 11, 5, 10, 11, 7, 5, 8, 3, 0, -1, -1, -1, -1, -1, -1, -1, 5, 11, 7, 5, 10, 11, 1, 9, 0, -1, -1, -1, -1, -1, -1, -1, 10, 7, 5, 10, 11, 7, 9, 8, 1, 8, 3, 1, -1, -1, -1, -1, 11, 1, 2, 11, 7, 1, 7, 5, 1, -1, -1, -1, -1, -1, -1, -1, 0, 8, 3, 1, 2, 7, 1, 7, 5, 7, 2, 11, -1, -1, -1, -1, 9, 7, 5, 9, 2, 7, 9, 0, 2, 2, 11, 7, -1, -1, -1, -1, 7, 5, 2, 7, 2, 11, 5, 9, 2, 3, 2, 8, 9, 8, 2, -1, 2, 5, 10, 2, 3, 5, 3, 7, 5, -1, -1, -1, -1, -1, -1, -1, 8, 2, 0, 8, 5, 2, 8, 7, 5, 10, 2, 5, -1, -1, -1, -1, 9, 0, 1, 5, 10, 3, 5, 3, 7, 3, 10, 2, -1, -1, -1, -1, 9, 8, 2, 9, 2, 1, 8, 7, 2, 10, 2, 5, 7, 5, 2, -1, 1, 3, 5, 3, 7, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 8, 7, 0, 7, 1, 1, 7, 5, -1, -1, -1, -1, -1, -1, -1, 9, 0, 3, 9, 3, 5, 5, 3, 7, -1, -1, -1, -1, -1, -1, -1, 9, 8, 7, 5, 9, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 5, 8, 4, 5, 10, 8, 10, 11, 8, -1, -1, -1, -1, -1, -1, -1, 5, 0, 4, 5, 11, 0, 5, 10, 11, 11, 3, 0, -1, -1, -1, -1, 0, 1, 9, 8, 4, 10, 8, 10, 11, 10, 4, 5, -1, -1, -1, -1, 10, 11, 4, 10, 4, 5, 11, 3, 4, 9, 4, 1, 3, 1, 4, -1, 2, 5, 1, 2, 8, 5, 2, 11, 8, 4, 5, 8, -1, -1, -1, -1, 0, 4, 11, 0, 11, 3, 4, 5, 11, 2, 11, 1, 5, 1, 11, -1, 0, 2, 5, 0, 5, 9, 2, 11, 5, 4, 5, 8, 11, 8, 5, -1, 9, 4, 5, 2, 11, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 2, 5, 10, 3, 5, 2, 3, 4, 5, 3, 8, 4, -1, -1, -1, -1, 5, 10, 2, 5, 2, 4, 4, 2, 0, -1, -1, -1, -1, -1, -1, -1, 3, 10, 2, 3, 5, 10, 3, 8, 5, 4, 5, 8, 0, 1, 9, -1, 5, 10, 2, 5, 2, 4, 1, 9, 2, 9, 4, 2, -1, -1, -1, -1, 8, 4, 5, 8, 5, 3, 3, 5, 1, -1, -1, -1, -1, -1, -1, -1, 0, 4, 5, 1, 0, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 8, 4, 5, 8, 5, 3, 9, 0, 5, 0, 3, 5, -1, -1, -1, -1, 9, 4, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 4, 11, 7, 4, 9, 11, 9, 10, 11, -1, -1, -1, -1, -1, -1, -1, 0, 8, 3, 4, 9, 7, 9, 11, 7, 9, 10, 11, -1, -1, -1, -1, 1, 10, 11, 1, 11, 4, 1, 4, 0, 7, 4, 11, -1, -1, -1, -1, 3, 1, 4, 3, 4, 8, 1, 10, 4, 7, 4, 11, 10, 11, 4, -1, 4, 11, 7, 9, 11, 4, 9, 2, 11, 9, 1, 2, -1, -1, -1, -1, 9, 7, 4, 9, 11, 7, 9, 1, 11, 2, 11, 1, 0, 8, 3, -1, 11, 7, 4, 11, 4, 2, 2, 4, 0, -1, -1, -1, -1, -1, -1, -1, 11, 7, 4, 11, 4, 2, 8, 3, 4, 3, 2, 4, -1, -1, -1, -1, 2, 9, 10, 2, 7, 9, 2, 3, 7, 7, 4, 9, -1, -1, -1, -1, 9, 10, 7, 9, 7, 4, 10, 2, 7, 8, 7, 0, 2, 0, 7, -1, 3, 7, 10, 3, 10, 2, 7, 4, 10, 1, 10, 0, 4, 0, 10, -1, 1, 10, 2, 8, 7, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 4, 9, 1, 4, 1, 7, 7, 1, 3, -1, -1, -1, -1, -1, -1, -1, 4, 9, 1, 4, 1, 7, 0, 8, 1, 8, 7, 1, -1, -1, -1, -1, 4, 0, 3, 7, 4, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 4, 8, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 9, 10, 8, 10, 11, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 3, 0, 9, 3, 9, 11, 11, 9, 10, -1, -1, -1, -1, -1, -1, -1, 0, 1, 10, 0, 10, 8, 8, 10, 11, -1, -1, -1, -1, -1, -1, -1, 3, 1, 10, 11, 3, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 2, 11, 1, 11, 9, 9, 11, 8, -1, -1, -1, -1, -1, -1, -1, 3, 0, 9, 3, 9, 11, 1, 2, 9, 2, 11, 9, -1, -1, -1, -1, 0, 2, 11, 8, 0, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 3, 2, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 2, 3, 8, 2, 8, 10, 10, 8, 9, -1, -1, -1, -1, -1, -1, -1, 9, 10, 2, 0, 9, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 2, 3, 8, 2, 8, 10, 0, 1, 8, 1, 10, 8, -1, -1, -1, -1, 1, 10, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 3, 8, 9, 1, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 9, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 3, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1]);
|
|
506
|
+
export { MarchingCubes, edgeTable, triTable };
|
|
507
|
+
export default MarchingCubes;
|