Class Path2F

  • All Implemented Interfaces:
    Cloneable

    public final class Path2F
    extends Object
    implements Cloneable
    Path2F represents and provides construction method for a 2D shape using float[2] points.
    • Constructor Detail

      • Path2F

        public Path2F()
      • Path2F

        public Path2F​(WindingRule rule,
                      int initialCapacity)
      • Path2F

        public Path2F​(WindingRule rule,
                      int initialTypeCapacity,
                      int initialPointCapacity)
      • Path2F

        public Path2F​(Path2F path)
    • Method Detail

      • moveTo

        public void moveTo​(float x,
                           float y)
        Start a new position for the next line segment at given point x/y (P1).
        Parameters:
        x - point (P1)
        y - point (P1)
      • lineTo

        public void lineTo​(float x,
                           float y)
        Add a line segment, intersecting the last point and the given point x/y (P1).
        Parameters:
        x - final point (P1)
        y - final point (P1)
      • quadTo

        public void quadTo​(float x1,
                           float y1,
                           float x2,
                           float y2)
        Add a quadratic curve segment, intersecting the last point and the second given point x2/y2 (P2).
        Parameters:
        x1 - quadratic parametric control point (P1)
        y1 - quadratic parametric control point (P1)
        x2 - final interpolated control point (P2)
        y2 - final interpolated control point (P2)
      • cubicTo

        public void cubicTo​(float x1,
                            float y1,
                            float x2,
                            float y2,
                            float x3,
                            float y3)
        Add a cubic Bézier curve segment, intersecting the last point and the second given point x3/y3 (P3).
        Parameters:
        x1 - Bézier control point (P1)
        y1 - Bézier control point (P1)
        x2 - Bézier control point (P2)
        y2 - Bézier control point (P2)
        x3 - final interpolated control point (P3)
        y3 - final interpolated control point (P3)
      • closePath

        public void closePath()
        Closes the current sub-path segment by drawing a straight line back to the coordinates of the last moveTo. If the path is already closed then this method has no effect.
      • size

        public final int size()
      • isClosed

        public final boolean isClosed()
        Returns true if the last sub-path is closed, otherwise false.
      • getWinding

        public Winding getWinding()
        Compute the general winding of the vertices
        Parameters:
        vertices - array of Vertices
        Returns:
        CCW or CW Winding
      • append

        public void append​(Path2F path,
                           boolean connect)
        Append the given path geometry to this instance
        Parameters:
        path - the Path2F to append to this instance
        connect - pass true to turn an initial moveTo segment into a lineTo segment to connect the new geometry to the existing path, otherwise pass false.
      • append

        public void append​(Path2F.Iterator path,
                           boolean connect)
        Append the given path geometry to this instance
        Parameters:
        path - the Path2F.Iterator to append to this instance
        connect - pass true to turn an initial moveTo segment into a lineTo segment to connect the new geometry to the existing path, otherwise pass false.
      • printSegments

        public void printSegments​(PrintStream out)
      • reset

        public void reset()
      • getBounds2D

        public final AABBox getBounds2D()
      • contains

        public boolean contains​(float px,
                                float py)
      • contains

        public boolean contains​(float rx,
                                float ry,
                                float rw,
                                float rh)
      • intersects

        public boolean intersects​(float rx,
                                  float ry,
                                  float rw,
                                  float rh)
      • contains

        public boolean contains​(AABBox r)
      • intersects

        public boolean intersects​(AABBox r)
      • clone

        public Object clone()