src/main/java/de/javagl/geom/Shapes.java
/**
     * Create a list containing line points that approximate the given 
     * shape.
     * 
     * @param shape The shape
     * @param flatness The allowed flatness
     * @param storeOnClose Whether a point should be stored when the 
     * shape is closed. (This will result in points being stored twice
     * in the returned list). 
     * @return The list of points
     */
Create a list containing line points that approximate the given
shape.

@param shape The shape
@param flatness The allowed flatness
@param storeOnClose Whether a point should be stored when the
shape is closed. (This will result in points being stored twice
in the returned list).
@return The list of points
Create a list containing line points that approximate the given shape . @param shape The shape @param flatness The allowed flatness @param storeOnClose Whether a point should be stored when the shape is closed . ( This will result in points being stored twice in the returned list ) . @return The list of points
public static List<Point2D> computePoints(
        Shape shape, double flatness, boolean storeOnClose)
    {
        List<Point2D> result = new ArrayList<Point2D>();
        PathIterator pi = shape.getPathIterator(null, flatness);
        double[] coords = new double[6];
        Point2D previousMove = null;
        while (!pi.isDone())
        {
            int segment = pi.currentSegment(coords);
            switch (segment)
            {
                case PathIterator.SEG_MOVETO:
                    result.add(new Point2D.Double(coords[0], coords[1]));
                    if (storeOnClose)
                    {
                        previousMove = new Point2D.Double(coords[0], coords[1]);
                    }
                    break;
                case PathIterator.SEG_CLOSE:
                    if (storeOnClose)
                    {
                        result.add(previousMove);
                    }
                    break;
                case PathIterator.SEG_LINETO:
                    result.add(new Point2D.Double(coords[0], coords[1]));
                    break;
                case PathIterator.SEG_QUADTO:
                    throw new AssertionError(
                        "SEG_QUADTO in flattened path!");
                case PathIterator.SEG_CUBICTO:
                    throw new AssertionError(
                        "SEG_CUBICTO in flattened path!");
                default:
                    throw new AssertionError(
                        "Invalid segment in flattened path!");
            }
            pi.next();
        }
        return result;
    }
public static List < Point2D > computePoints ( Shape shape , double flatness , boolean storeOnClose ) { List < Point2D > result = new ArrayList < Point2D > ( ) ; PathIterator pi = shape . getPathIterator ( null , flatness ) ; double [ ] coords = new double [ 6 ] ; Point2D previousMove = null ; while ( ! pi . isDone ( ) ) { int segment = pi . currentSegment ( coords ) ; switch ( segment ) { case PathIterator . SEG_MOVETO : result . add ( new Point2D . Double ( coords [ 0 ] , coords [ 1 ] ) ) ; if ( storeOnClose ) { previousMove = new Point2D . Double ( coords [ 0 ] , coords [ 1 ] ) ; } break ; case PathIterator . SEG_CLOSE : if ( storeOnClose ) { result . add ( previousMove ) ; } break ; case PathIterator . SEG_LINETO : result . add ( new Point2D . Double ( coords [ 0 ] , coords [ 1 ] ) ) ; break ; case PathIterator . SEG_QUADTO : throw new AssertionError ( "SEG_QUADTO in flattened path!" ) ; case PathIterator . SEG_CUBICTO : throw new AssertionError ( "SEG_CUBICTO in flattened path!" ) ; default : throw new AssertionError ( "Invalid segment in flattened path!" ) ; } pi . next ( ) ; } return result ; }
Create a list containing line points that approximate the given
 shape.
Create a list containing line points that approximate the given shape .
// Should never occur
 // Should never occur
 // Should never occur
