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 paths (RPath). 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(newpath);
RShape(newpaths);
RShape(s);
RGeomElem();
Fields
paths   Array of RPath objects holding the paths of the polygon.

Methods
adapt ( )   Use this method to adapt a group of of figures to a shape.

addBezierTo ( )   Use this method to add a new bezierTo command to the current path. 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 path. 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 path in the shape. It's similar to adding a new contour to a polygon.

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

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

contains ( )   Use this to return a specific tangent on the curve. It returns true if the point passed as a parameter is inside the shape. Implementation taken from: http://www.ecse.rpi.edu/Homepages/wrf/Research/Short_Notes/pnpoly.html

countPaths ( )   Use this method to count the number of paths in the polygon.

createEllipse ( )   Use this method to create a new elliptical shape.

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

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.

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.

getCurveLength ( )   Use this to return the points on the curve. It returns the points in the way of an array of RPoint.

getCurveLengths ( )   Use this to return the points on the curve. It returns the points in the way of an array of RPoint.

getHandles ( )   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.

getHeight ( )   Use this method to get the height of the element.

getPoint ( )   Use this to return a point on the curve given a certain advancement. It returns the point in the way of an RPoint.

getPoints ( )   Use this to return the points on the curve of the shape. It returns the point in the way of an RPoint.

getPointsInPaths ( )   Use this to return the points of each path of the group. It returns the points in the way of an array of array of RPoint.

getTangent ( )   Use this to return a point on the curve given a certain advancement. It returns the point in the way of an RPoint.

getTangents ( )   Use this to return the points on the curve of the shape. It returns the point in the way of an RPoint.

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

getWidth ( )   Use this method to get the width of the element.

getX ( )   Use this method to get the x (left side position) of the element.

getY ( )   Use this method to get the y (left side position) of the element.

insertHandle ( )   Use this to insert a split point into the shape.

insertHandleInPaths ( )   Use this to insert a split point into each command of the shape.

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 shape is inside a graphics object. This might be useful if we want to delete objects that go offscreen.

rotate ( )   Use this to apply a rotation to the point.

scale ( )   Use this to scale the point.

setPath ( )   Use this method to set the current path.

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 ( )   Transform the geometric object to fit in a rectangle defined by the parameters passed.

translate ( )   Use this to apply a translation to the point.

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

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

Usage Geometry
Related RPath