private float getMaxPerdua(Vector vPoints, int startIndex, int endIndex) { Line2D.Float l = new Line2D.Float( (Point2D) vPoints.elementAt(startIndex), (Point2D) vPoints.elementAt(endIndex)); double max = 0; for (int i = startIndex + 1; i < endIndex; i++) max = Math.max(max, l.ptSegDist((Point2D) vPoints.elementAt(i))); return (float) max; }
private float getPerdua(Vector vPoints, int startIndex, int endIndex) { Line2D.Float l = new Line2D.Float( (Point2D) vPoints.elementAt(startIndex), (Point2D) vPoints.elementAt(endIndex)); float d = 0; for (int i = startIndex + 1; i < endIndex; i++) d += l.ptSegDist((Point2D) vPoints.elementAt(i)); return d; }