geomerative index
Name RPolygon
Examples
None available
Description RPolygon is a reduced interface for creating, holding and drawing complex polygons. Polygons are groups of one or more contours (RContour). This interface allows to perform binary operations (difference, xor, union and intersection) on polygons.
Constructors
RPolygon();
RPolygon(newcontour);
RPolygon(p);
RGeomElem();
Parameters
RContour   newcontour, the contour for the new polygon.
RPolygon   p, the object of which to make a copy
Fields
contours   Array of RContour objects holding the contours of the polygon.

Methods
addContour ( )   Use this method to create a new contour.

addPoint ( )   Use this method to add new points to the current contour.

countContours ( )   Use this method to count the number of contours in the polygon.

createCircle ( )   Use this method to create a new circle polygon.

createRectangle ( )   Use this method to create a new rectangle polygon.

createRing ( )   Use this method to create a new ring polygon.

createStar ( )   Use this method to create a new starform polygon.

diff ( )   Use this method to get the difference of the given polygon with the polygon passed as atribute.

draw ( )   Use this method to draw the polygon.

getArea ( )   Use this method to get the area of an element.

getBounds ( )   Use this method to get the bounding box of the element.

getCenter ( )   Use this method to get the center point of the element.

getCenteringTransf ( )   Use this method to get the transformation matrix in order to fit and center the element on the canvas. Scaling and translation damping parameters are available, in order to create animations.

getCentroid ( )   Use this method to get the centroid of the element.

getPoints ( )   Use this to return the points of the polygon. It returns the points in the way of an array of RPoint.

getType ( )   Use this method to get the type of element this is.

intersection ( )   Use this method to get the intersection of the given polygon with the polygon passed as atribute.

isIn ( )   Use this method to know if the polygon is inside a graphics object. This might be useful if we want to delete objects that go offscreen.

setCurrent ( )   Use this method to set the current contour to which append points.

toMesh ( )   Use this method to create a new mesh from a given polygon.

transform ( )   Use this method to transform the polygon.

union ( )   Use this method to get the union of the given polygon with the polygon passed as atribute.

update ( )   Use this method to get a rebuilt version of a given polygon by removing extra points and solving intersecting contours or holes.

xor ( )   Use this method to get the xor of the given polygon with the polygon passed as atribute.

Usage Geometry
Related RContour
createCircle ( )
createRing ( )
createStar ( )
diff ( )
xor ( )
union ( )
intersection ( )