geomerative index
Name RShape
Examples
None available
Description RShape is a reduced interface for creating, holding and drawing complex Shapes. Shapes are groups of one or more subshapes (RSubshape). Shapes can be selfintersecting and can contain holes. This interface also allows you to transform shapes into polygons by segmenting the curves forming the shape.
Constructors
RShape();
RShape(newsubshape);
RShape(s);
RGeomElem();
Fields
subshapes   Array of RSubshape objects holding the subshapes of the polygon.

Methods
addBezierTo ( )   Use this method to add a new bezierTo command to the current subshape. This will add a cubic bezier from the last point added with the control and ending points passed as arguments.

addLineTo ( )   Use this method to add a new lineTo command to the current subshape. This will add a line from the last point added to the point passed as argument.

addMoveTo ( )   Use this method to add a new moveTo command to the shape. The command moveTo acts different to normal commands, in order to make a better analogy to its borthers classes Polygon and Mesh. MoveTo creates a new subshape in the shape. It's similar to adding a new contour to a polygon.

addQuadTo ( )   Use this method to add a new quadTo command to the current subshape. This will add a quadratic bezier from the last point added with the control and ending points passed as arguments.

addSubshape ( )   Use this method to create a new subshape. The first point of the new subshape will be set to (0,0). Use addMoveTo ( ) in order to add a new subshape with a different first point.

countSubshapes ( )   Use this method to count the number of subshapes in the polygon.

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

draw ( )   Use this method to draw the shape.

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 start, control and end points of the shape. It returns the points in the way of an array of RPoint.

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

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

setSubshape ( )   Use this method to set the current subshape.

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

toPolygon ( )   Use this method to create a new polygon from a given shape.

transform ( )   Use this method to transform the shape.

Usage Geometry
Related RSubshape