I am struggling with the processing code :-( I wanto to develope a 3d typography-mesh using toxiclips. I though that a good idea is mixing toxiclibs and geomerative libraries. but my problem is, how can I mix this code (below) from toxi with geomerative. Growth come from the part in red (look the code please) and i want the this code read the points from a letter to make the typographie. Any idea to do this?
import toxi.geom.*;
import toxi.geom.mesh.*;
import toxi.volume.*;
import toxi.math.waves.*;
import toxi.processing.*;
import processing.opengl.*;
int DIMX=36;//distacia de cada brazo
int DIMY=36;
int DIMZ=36;
float ISO_THRESHOLD = .1;
float NS=.03;
Vec3D SCALE=new Vec3D(226,253,384);//escala de los vectores, ms chico mas grande, se puede cambiar
VolumetricSpace volume;
VolumetricBrush brush;
IsoSurface surface;
TriangleMesh mesh;
AbstractWave brushSize;
boolean isWireframe=false;
boolean doSave=false;
float currScale=1;
float density=.5;
float spin=.8;
float currZ=0.1;//tiene que ver algo con el naciemiento;
float Z_STEP=0.005;
ToxiclibsSupport gfx;
void setup() {
size(1024,768,OPENGL);
// hint(ENABLE_OPENGL_4X_SMOOTH);
gfx=new ToxiclibsSupport(this);
// strokeWeight(0.5);
volume=new VolumetricSpaceArray(SCALE,DIMX,DIMY,DIMZ);
brush=new RoundBrush(volume,SCALE.x/2);
brushSize=new SineWave(PI,2*TWO_PI*Z_STEP,SCALE.x*0.03,SCALE.x*0.06);//en el 2 cambia la forma
surface=new ArrayIsoSurface(volume);//aki es donde nace esto tiene ke leer las letras
mesh=new TriangleMesh();
}
void draw() {
brush.setSize(brushSize.update());
float offsetZ=-SCALE.z+currZ*SCALE.z*.6666;//cambia el .6666por algun variable para mas variacion
float currRadius=SCALE.x*0.4*sin(currZ*PI);
for(float t=0; t<TWO_PI; t+=TWO_PI/5) {
brush.drawAtAbsolutePos(new Vec3D(currRadius*cos(t+currZ*spin),currRadius*sin(t+currZ*spin),offsetZ),density);
brush.drawAtAbsolutePos(new Vec3D(currRadius*cos(t-currZ*spin),currRadius*sin(t-currZ*spin),offsetZ),density);
}
currZ+=Z_STEP;
volume.closeSides();
surface.reset();
surface.computeSurfaceMesh(mesh,ISO_THRESHOLD);
if (doSave) {
// save mesh as STL or OBJ file
mesh.saveAsSTL(sketchPath("cup"+(System.currentTimeMillis()/1000)+".stl"));
doSave=false;
System.exit(1);
}
background(128);
translate(width/2,height/2,0);
lightSpecular(230,230,230);
directionalLight(255,255,255,1,1,-1);
shininess(1.0);
rotateX(-0.4);
rotateY(frameCount*0.05);
scale(currScale);
noStroke();
gfx.mesh(mesh);
}
void keyPressed() {
if(key=='-') currScale=max(currScale-0.1,0.5);
if(key=='=') currScale=min(currScale+0.1,10);
if(key=='w') {
isWireframe=!isWireframe;
return;
}
if(key=='s') {
doSave=true;
return;
}
if (key>='1' && key<='9') {
density=-0.5+(key-'1')*0.1;
println(density);
}
if (key=='0') density=0.5;
if (key>='a' && key<='z') ISO_THRESHOLD=(key-'a')*0.019+0.01;
}