public void setup() {
size(100, 100);
// size(1024, 768, OPENGL);
// hint(ENABLE_OPENGL_4X_SMOOTH);
strokeWeight(0.5f);
VolumetricSpace volume = new VolumetricSpaceArray(SCALE, DIMX, DIMY,
DIMZ);
// fill volume with noise
for (int z = 0, index = 0; z < DIMZ; z++) {
println(z);
for (int y = 0; y < DIMY; y++) {
for (int x = 0; x < DIMX; x++) {
volume.setVoxelAt(
x,
y,
z,
(float) SimplexNoise.noise(x * NS, y * NS, z * NS) * 0.5f);
}
}
}
println("noise done");
volume.closeSides();
long t0 = System.nanoTime();
// store in IsoSurface and compute surface mesh for the given threshold
// value
mesh = new TriangleMesh("iso", 4000000, 12000000);
surface = new HashIsoSurface(volume, 0.33f);