
Keeping up looking to the Igeo library for processing, I found the delaunay2D class and had a go at it. Below is an example that creates some random points and invokes the delaunay2D class in iGeo to solve a delaunay triangulation in 2d.
It’s a very basic example, more to follow. . .
enjoy!
import processing.opengl.*;
import igeo.*;
void setup() {
size( 1200, 800, IG.GL );
frameRate(0.5);// the redrawing process is slow so we see every new triangulation
//IG.top();// Maximises the top vieport
strokeWeight(0.1);
}
double z = 0.0;
int ptNo = 20; // Specifies the number of random points used for the triagulation
void draw()
{
IVec2[] myVectors = new IVec2[ptNo];
z = z + 20.0;//creates a different triangulation every 20 units along the z axis
for (int i=0; i<ptNo; i++)
{
myVectors[i] = new IVec2(random(0, 1000), random(0, 1000));
}
IDelaunay2D myDelaunay = new IDelaunay2D();
IVec2[][] myTriangles = myDelaunay.getTriangles(myVectors);
for (int i = 0; i<myTriangles.length; i++)
{
IVec[] ver = new IVec[3];
for (int j = 0; j<3; j++)
{
ver[j] = myTriangles[i][j].to3d(z);
new IPoint(ver[j]).clr(((255/20)*i), 0, (255/20)*(20-i)) ;
}
//new ISurface(ver).clr(255, 0, 0);// uncomment to construct 3 point surfaces
new ICurve(ver).clr(int(random(255)));
}
}

This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 2.0 UK: England & Wales License.