//***************************************************************************** // Delaunay Triangulaiotn, Jarek Rossignac, March 2006 //***************************************************************************** int vn =5; // number of points (sites) int cap=1024; // max number of points pt[] P = new pt [cap]; // Array containing the points int bi=-1; // index of selected mouse-vertex, -1 if none selected pt Mouse = new pt(0,0); // current mouse position color red = color(200, 10, 10); color blue = color(10, 10, 200); color green = color(0, 150, 0); boolean dots = true; // toggles display circle centers boolean numbers = true; // toggles display of vertex numbers void setup() { size(600, 600); strokeJoin(ROUND); strokeCap(ROUND); PFont font = loadFont("Courier-14.vlw"); textFont(font, 12); for (int i=0; i10) { bi=vn++; P[bi].setFromMouse(); // if closest vertex is too far }; } float d2(int j) {return (Mouse.disTo(P[j]));}; // squared distance from mouse to vertex P[j] void mouseReleased() { // do this when mouse released if ( (bi!=-1) && P[bi].isOut() ) { // if outside of port for (int i=bi; ibx) {bx=P[i].x;}; if (P[i].xby) {by=P[i].y;}; if (P[i].y