boolean loopIsClosed = true; int n=4; // current number of points pt [] P = new pt[1000]; // decalres an array of vertices int p=0; // index to the currently selected vertex being dragged int next(int j) { if (j==n-1) {return (0);} else {return(j+1);} }; // next point in loop int prev(int j) { if (j==0) {return (n-1);} else {return(j-1);} }; // previous point in loop void declarePoints() {for (int i=0; i