Second Test
Code for my Second test
import toxi.geom.*;import toxi.geom.mesh.*;
import toxi.volume.*;
import toxi.processing.*;
ToxiclibsSupport gfx;
TriangleMesh mesh;
VolumetricSpace volume;
void setup() {
size(1200,670,P3D);
gfx = new ToxiclibsSupport(this);
volume = new VolumetricSpaceArray(new Vec3D(2000,5000,4500), 9,10,7);
IsoSurface surface = new ArrayIsoSurface(volume);
mesh = new TriangleMesh();
VolumetricBrush brush = new RoundBrush(volume, 50.0);
for(int i = 0; i < 10; i++){
for(int j = 0; j < 10; j++){
for(int k = 0; k < 11; k++){
brush.drawAtAbsolutePos(new Vec3D((i*20)-40 +random(5), (j*20)-50+random(5), (k*20)-50+random(5)), 1 );
}
}
}
volume.closeSides();
surface.reset();
surface.computeSurfaceMesh(mesh, 0.1);
}
void draw() {
background(255);
lights();
translate(width/2,height/2,0);
rotateX(mouseY*0.01);
rotateY(mouseX*0.01);
scale(0.5);
gfx.mesh(mesh);
fill(255,50,50,100);
noStroke();
beginShape(TRIANGLES);
gfx.mesh( mesh );
endShape();
}
void keyPressed() {
if (key=='p') {
mesh.saveAsSTL( sketchPath( "toxic_output.stl" ));
}
}
That created This


No comments:
Post a Comment