class Polyloop { // class of polyloops (closed loop polygon) int vn = 6, cap=1024; // number of control vertices and the cap on vn. WAS 5000 pt[] P = new pt [cap]; // control points vec[] L = new vec [cap]; // adjustment vectors for smoothing // CONSRTUCT, COPY FROM Polyloop () { vn=0; for (int i=0; i5) P[vn++].setTo(Mouse()); } // appends a point // ACCESS POINTS and LOOPING INDICES pt rP(int i) {return P[i];} // returns P[i] (so that the caller chan change it!!! pt cP(int i) {return P(P[i]);} // returns a (safe) copy of P[i] int n(int j) { if (j==vn-1) {return (0);} else {return(j+1);} }; // n vertex in loop int p(int j) { if (j==0) {return (vn-1);} else {return(j-1);} }; // pious vertex in loop pt pickPoint() {pt Q = P[0]; float dist = P[0].disToMouse(); for(int i = 0; i < P.length; i++) if(P[i].disToMouse() < dist) {Q = P[i]; dist = P[i].disToMouse(); }; if (dist>width/10) Q=null; return Q; } // DISPLAY void drawVertices() {beginShape(POINTS); for (int i=0; i=vn) for (int i=0; ibx) {bx=P[i].x;}; if (P[i].xby) {by=P[i].y;}; if (P[i].y