geomerative
Class RContour

java.lang.Object
  extended by geomerative.RGeomElem
      extended by geomerative.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 Summary
 RPoint[] points
          Array of RPoint objects holding the points of the contour.
 int type
           
 
Fields inherited from class geomerative.RGeomElem
COMMAND, CONTOUR, GROUP, height, MESH, name, POLYGON, SHAPE, SUBSHAPE, TRISTRIP, UNKNOWN, width
 
Constructor Summary
RContour()
           
RContour(RContour c)
           
RContour(RPoint[] contourpoints)
          Create a countour given an array of points.
 
Method Summary
 void addClose()
           
 void addPoint(float x, float y)
           
 void addPoint(RPoint p)
          Use this method to add new points to the contour.
 void addPoints(java.util.List morePoints)
          Efficiently add a list of points to the contour.
 void addPoints(RPoint[] morePoints)
          Efficiently add an array of points to the contour.
 boolean contains(RPoint p)
           
 int countPoints()
          Use this method to count the number of points in the contour.
 void draw(processing.core.PApplet g)
           
 void draw(processing.core.PGraphics g)
          Use this method to draw the contour.
 RPoint[] getHandles()
          Use this to return the points of the contour.
 RPoint[][] getHandlesInPaths()
           
 RPoint getPoint(float t)
           
 RPoint[] getPoints()
          Use this to return the points of the contour.
 RPoint[][] getPointsInPaths()
           
 RPoint getTangent(float t)
           
 RPoint[] getTangents()
           
 RPoint[][] getTangentsInPaths()
           
 int getType()
          Use this method to get the type of element this is.
 boolean isHole()
          Use this method to know if the contour is a hole.
 void print()
           
 RMesh toMesh()
           
 RPolygon toPolygon()
           
 RShape toShape()
           
 
Methods inherited from class geomerative.RGeomElem
centerIn, centerIn, centerIn, contains, contains, containsBounds, containsHandles, draw, getArea, getBottomLeft, getBottomRight, getBounds, getBoundsPoints, getCenter, getCenteringTransf, getCenteringTransf, getCenteringTransf, getCentroid, getCurveLength, getCurveLengths, getHeight, getOrigHeight, getOrigWidth, getStyle, getTopLeft, getTopRight, getWidth, getX, getY, intersects, intersects, intersectsBounds, intersectsHandles, isIn, isIn, rotate, rotate, rotate, scale, scale, scale, scale, scale, scale, setAlpha, setAlpha, setAlpha, setFill, setFill, setFill, setFillAlpha, setFillAlpha, setName, setStroke, setStroke, setStroke, setStrokeAlpha, setStrokeAlpha, setStrokeCap, setStrokeJoin, setStrokeWeight, setStrokeWeight, setStyle, shear, skewX, skewY, transform, transform, transform, translate, translate
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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 mesh

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.

getPoint

public RPoint getPoint(float t)
Specified by:
getPoint in class RGeomElem

getTangent

public RPoint getTangent(float t)
Specified by:
getTangent in class RGeomElem

getTangents

public RPoint[] getTangents()
Specified by:
getTangents in class RGeomElem

getPointsInPaths

public RPoint[][] getPointsInPaths()
Specified by:
getPointsInPaths in class RGeomElem

getHandlesInPaths

public RPoint[][] getHandlesInPaths()
Specified by:
getHandlesInPaths in class RGeomElem

getTangentsInPaths

public RPoint[][] getTangentsInPaths()
Specified by:
getTangentsInPaths in class RGeomElem

contains

public boolean contains(RPoint p)
Specified by:
contains in class RGeomElem

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

print

public void print()
Overrides:
print in class RGeomElem

addClose

public void addClose()

toPolygon

public RPolygon toPolygon()
Overrides:
toPolygon in class RGeomElem

toShape

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

toMesh

public RMesh toMesh()
Overrides:
toMesh in class RGeomElem

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


Geomerative by Ricard Marxer, http://www.ricardmarxer.com/geomerative/