//***************************************************************************** // TITLE: Smoothing // DESCRIPTION: To show smoothing process in a polyloop // AUTHOR: Sungbae Kim // DATE CREATED: Sep. 3. 2007 // EDITS: //***************************************************************************** boolean showText = true; // toggled by key to show/hide help text boolean printIt=false; // temporarily set when a key is pressed and used to print some debugging values int mousepoint; //! n is the total number of points. int n=5; //! decalres an array of n points pt [] PP = new pt[n]; int p=0; // index to the point being dragged // Those are predefined colors of Professor Jarek. color red, yellow, green, cyan, blue, magenta, dred, dyellow, dgreen, dcyan, dblue, dmagenta, white, black, orange, grey, metal; // declares colors Vector oldpolyloop = new Vector(); Vector polyloop = new Vector(); Vector smoothingVector = new Vector(); boolean smoothing = false; boolean reset = false; int smoothingtimes = 0; class vertex { pt P; boolean isNew; vertex() { P = new pt(); isNew = false; } vertex(vertex V) { P = new pt(); P.setTo(V.P); isNew = V.isNew; }; } void resetPolyloop() { oldpolyloop.clear(); polyloop.clear(); smoothingVector.clear(); for (int i=0; i