// TO DO // resample polyloop !!! // compute center of mass G and show // rshift otate zoom wrt G // CP map int _rec=3, _deg=3; // number of recursions and B-spline degree //float _ga=-1.535224, _gb= 0.410048, _gs=1.5; // subdivision parameters float _ga=1, _gb=1, _gs=1; // subdivision parameters float [] _w = new float[5]; // weights for retrofitting boolean symmetryEnds=true; class Polyloop { // class of polyloops (closed loop polygon) int vn = 5, cap=5000; // number of control vertices and the cap on vn pt[] P = new pt [cap]; // control points vec[] L = new vec [cap]; // adjustment vectors pt G = new pt(0,0); // center of mass float a = 0; // angle to axis ring [] R = new ring[7]; // 7 rings int rc; // counter showing the next control point to load in the top rig Stepper stepper = new Stepper(_rec); // stepper for knowing which ring to advance int bi=-1; boolean openLoop; // says that curve is int p = 0; // id of point selected with mouse for dragging float area; pt lastPt = new pt(0,0), thisPt = new pt(0,0); int ctr; //used to sum up the area int ni(int i) {return (i+1)%vn;} int pi(int i) {return (i+vn-1)%vn;} Polyloop () {vn=0; for (int i=0; i=vn) for (int i=0; i0; i--) P[i].setTo(P[i-1]); P[0].setTo(P0); }; // shits vetex table void shiftIDs(int n) {for (int j=0; j0; i--) P[i].setTo(P[i-1]); P[0].setTo(P0); };}; // shifts vetex table void dual() {this.refine(); this.coarsen();} void coarsen() {vn/=2; for (int i=0; i