hi!
i have generated some 3d polygons but now i want to cast them in a TriangleMesh to tap all capabilities of toxiclibs.
how can i do?
this is a little example:
- import toxi.geom.*;
- Vec3D pts[] = {
- new Vec3D(1.0, 1.0, 1.0), new Vec3D(0.0, 0.618034, 1.618034),
- new Vec3D(1.0, 1.0, 1.0), new Vec3D(1.618034, 0.0, 0.618034),
- new Vec3D(1.0, 1.0, 1.0), new Vec3D(0.618034, 1.618034, 0.0),
- new Vec3D(1.0, 1.0, -1.0), new Vec3D(0.0, 0.618034, -1.618034),
- new Vec3D(1.0, 1.0, -1.0), new Vec3D(1.618034, 0.0, -0.618034),
- new Vec3D(1.0, 1.0, -1.0), new Vec3D(0.618034, 1.618034, 0.0),
- new Vec3D(1.0, -1.0, 1.0), new Vec3D(0.0, -0.618034, 1.618034),
- new Vec3D(1.0, -1.0, 1.0), new Vec3D(1.618034, 0.0, 0.618034),
- new Vec3D(1.0, -1.0, 1.0), new Vec3D(0.618034, -1.618034, 0.0),
- new Vec3D(1.0, -1.0, -1.0), new Vec3D(0.0, -0.618034, -1.618034),
- new Vec3D(1.0, -1.0, -1.0), new Vec3D(1.618034, 0.0, -0.618034),
- new Vec3D(1.0, -1.0, -1.0), new Vec3D(0.618034, -1.618034, 0.0),
- new Vec3D(-1.0, 1.0, 1.0), new Vec3D(0.0, 0.618034, 1.618034),
- new Vec3D(-1.0, 1.0, 1.0), new Vec3D(-1.618034, 0.0, 0.618034),
- new Vec3D(-1.0, 1.0, 1.0), new Vec3D(-0.618034, 1.618034, 0.0),
- new Vec3D(-1.0, 1.0, -1.0), new Vec3D(0.0, 0.618034, -1.618034),
- new Vec3D(-1.0, 1.0, -1.0), new Vec3D(-1.618034, 0.0, -0.618034),
- new Vec3D(-1.0, 1.0, -1.0), new Vec3D(-0.618034, 1.618034, 0.0),
- new Vec3D(-1.0, -1.0, 1.0), new Vec3D(0.0, -0.618034, 1.618034),
- new Vec3D(-1.0, -1.0, 1.0), new Vec3D(-1.618034, 0.0, 0.618034),
- new Vec3D(-1.0, -1.0, 1.0), new Vec3D(-0.618034, -1.618034, 0.0),
- new Vec3D(-1.0, -1.0, -1.0), new Vec3D(0.0, -0.618034, -1.618034),
- new Vec3D(-1.0, -1.0, -1.0), new Vec3D(-1.618034, 0.0, -0.618034),
- new Vec3D(-1.0, -1.0, -1.0), new Vec3D(-0.618034, -1.618034, 0.0),
- new Vec3D(0.0, 0.618034, 1.618034), new Vec3D(0.0, -0.618034, 1.618034),
- new Vec3D(0.0, 0.618034, -1.618034), new Vec3D(0.0, -0.618034, -1.618034),
- new Vec3D(1.618034, 0.0, 0.618034), new Vec3D(1.618034, 0.0, -0.618034),
- new Vec3D(-1.618034, 0.0, 0.618034), new Vec3D(-1.618034, 0.0, -0.618034),
- new Vec3D(0.618034, 1.618034, 0.0), new Vec3D(-0.618034, 1.618034, 0.0),
- new Vec3D(0.618034, -1.618034, 0.0), new Vec3D(-0.618034, -1.618034, 0.0),
- };
- void setup() {
- size(400, 400, P3D);
- }
- void draw() {
- background(255);
- translate(width/2, height/2);
- float rx = mouseY * 0.01f;
- float ry = mouseX * 0.01f;
- rotateX(rx);
- rotateY(ry);
- Vec3D v1, v2;
- for (int i=0; i<pts.length-1; i+=2) {
- v1 = pts[i];
- v2 = pts[i+1];
- line(v1.x*100, v1.y*100, v1.z*100,
- v2.x*100, v2.y*100, v2.z*100);
- }
- }
edit: mayebe is it possible with hemesh?
1