float temp, distance = Float.POSITIVE_INFINITY;
float distance = Float.POSITIVE_INFINITY;
    public float distanceToEdge(int x, int y) {        float temp, distance = Float.POSITIVE_INFINITY;        if (getNeedToRegenerate() || shape == null) {            return distance;        }        PathIterator pi2 = shape.getPathIterator(null);        FlatteningPathIterator pi = new FlatteningPathIterator(pi2, .25);        double[] coords = new double[6];        int count = 0;        double startPntX = 0;        double startPntY = 0;        double endPntX = 0;        double endPntY = 0;        while (!pi.isDone()) {            int type = pi.currentSegment(coords);            float dist;            if (type == PathIterator.SEG_LINETO) {                startPntX = endPntX;                startPntY = endPntY;                endPntX = coords[0];                endPntY = coords[1];                dist = (float) Line2D.ptSegDist(startPntX,                        startPntY,                        endPntX,                        endPntY,                        (double) x,                        (double) y);                if (dist < distance) {                    distance = dist;                }                if (Debug.debugging("omgraphicdetail")) {                    Debug.output("Type: " + type + "(" + (count++) + "), "                            + startPntX + ", " + startPntY + ", " + endPntX                            + ", " + endPntY + ", " + x + ", " + y                            + ", distance: " + distance);                }            } else {                // This should be the first and last                // condition, SEG_MOVETO and SEG_CLOSE                startPntX = coords[0];                startPntY = coords[1];                endPntX = coords[0];                endPntY = coords[1];            }            pi.next();        }        return distance;    }