Package geomerative

Class RContour


  • public class RContour
    extends RGeomElem
    RContour is a reduced interface for creating, holding and drawing contours. Contours are ordered lists of points (RPoint) which define the outlines of polygons. Contours can be self-intersecting.
    • Field Detail

      • type

        public int type
      • points

        public RPoint[] points
        Array of RPoint objects holding the points of the contour.
    • Constructor Detail

      • RContour

        public RContour​(RPoint[] contourpoints)
        Create a countour given an array of points.
        Parameters:
        contourpoints - the points of the new contour
      • RContour

        public RContour()
      • RContour

        public RContour​(RContour c)
    • Method Detail

      • countPoints

        public int countPoints()
        Use this method to count the number of points in the contour.
        Returns:
        int, the number points in the contour
      • draw

        public void draw​(processing.core.PGraphics g)
        Use this method to draw the contour.
        Specified by:
        draw in class RGeomElem
        Parameters:
        g - PGraphics, the graphics object on which to draw the contour
      • draw

        public void draw​(processing.core.PApplet g)
        Specified by:
        draw in class RGeomElem
      • addPoint

        public void addPoint​(RPoint p)
        Use this method to add new points to the contour.
      • addPoint

        public void addPoint​(float x,
                             float y)
      • addPoints

        public void addPoints​(RPoint[] morePoints)
        Efficiently add an array of points to the contour.
      • addPoints

        public void addPoints​(java.util.List morePoints)
        Efficiently add a list of points to the contour.
      • getHandles

        public RPoint[] getHandles()
        Use this to return the points of the contour. It returns the points in the way of an array of RPoint.
        Specified by:
        getHandles in class RGeomElem
        Returns:
        RPoint[], the points returned in an array.
      • getPoints

        public RPoint[] getPoints()
        Use this to return the points of the contour. It returns the points in the way of an array of RPoint.
        Specified by:
        getPoints in class RGeomElem
        Returns:
        RPoint[], the points returned in an array.
      • isHole

        public boolean isHole()
        Use this method to know if the contour is a hole. Remember to use the method update() on the polygon before using this method.
        Returns:
        boolean, true if it is a hole
      • addClose

        public void addClose()
      • toShape

        public RShape toShape()
                       throws java.lang.RuntimeException
        Specified by:
        toShape in class RGeomElem
        Throws:
        java.lang.RuntimeException
      • getType

        public int getType()
        Use this method to get the type of element this is.
        Specified by:
        getType in class RGeomElem
        Returns:
        int, will allways return RGeomElem.POLYGON