/** * @return a string with information about the current status of the algorithm. */ public String getStatus() { return status + this.getSize(); }
/** * Returns a string with information about the current status of the algorithm. */ public String getStatus() { return status + this.getSize(); }
/** * Shift all vertices so that the center of gravity is located at * the center of the screen. */ public void adjustForGravity() { Dimension d = getSize(); double height = d.getHeight(); double width = d.getWidth(); double gx = 0; double gy = 0; for (int i = 0; i < xydata.length; i++) { gx += xydata[i].getX(); gy += xydata[i].getY(); } gx /= xydata.length; gy /= xydata.length; double diffx = width / 2 - gx; double diffy = height / 2 - gy; for (int i = 0; i < xydata.length; i++) { xydata[i].setLocation(xydata[i].getX()+diffx, xydata[i].getY()+diffy); } }
/** * Shift all vertices so that the center of gravity is located at * the center of the screen. */ public void adjustForGravity() { Dimension d = getSize(); double height = d.getHeight(); double width = d.getWidth(); double gx = 0; double gy = 0; for (int i = 0; i < xydata.length; i++) { gx += xydata[i].getX(); gy += xydata[i].getY(); } gx /= xydata.length; gy /= xydata.length; double diffx = width / 2 - gx; double diffy = height / 2 - gy; for (int i = 0; i < xydata.length; i++) { xydata[i].setLocation(xydata[i].getX()+diffx, xydata[i].getY()+diffy); } }