From the example, mostly:
import wblut.processing.*;
import wblut.geom.*;
import wblut.core.*;
import wblut.math.*;
import java.util.List;
List<WB_Point> points;
WB_Delaunay triangulation;
WB_Predicates pred = new WB_Predicates();
WB_Render3D render;
void setup() {
size(800, 800, OPENGL);
render = new WB_Render3D(this);
smooth(8);
create();
}
void create() {
points = new ArrayList<WB_Point>();
float r = 200;
float spacing = 40.0;
float[] point = new float[3];
for (int x = 0; x < width; x += spacing) {
for (int y = 0; y < height; y += spacing) {
//point[0] = random(-r, r);
//point[1] = random(-r, r);
point[2] = random(-r, r);
points.add(new WB_Point(x, y, point[2]));
}
}
float m = millis();
triangulation = WB_Delaunay.getTriangulation3D(points, 0.001);
println(millis() - m);
}
void draw() {
background(255);
translate(400, 400, 0);
directionalLight(255, 255, 255, 1, 1, -1);
directionalLight(127, 127, 127, -1, -1, 1);
//rotateY(mouseX*1.0f/width*TWO_PI);
//rotateX(mouseY*1.0f/height*TWO_PI);
fill(255, 0, 0);
for (int i=0; i<triangulation.Tri.length; i++) {
render.drawTetrahedron(triangulation.Tri[i], points);
//render.drawMesh(triangulation.Tri[i], points);
}
}
It's so close to what I want, except that I want to look a bit like terrain, rather than an enclosed shape. The Delaunay triangulation is what I'm after. I have a set of points that come from an image, and then I'll use the brightness to set the Z value. So instead of drawTetrahedron() is there some method that will spit out a plane old mesh?