|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectgeomerative.RGeomElem
geomerative.RShape
public class RShape
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.
Field Summary | |
---|---|
RShape[] |
children
|
RPath[] |
paths
Array of RPath objects holding the paths of the polygon. |
int |
type
|
Fields inherited from class geomerative.RGeomElem |
---|
COMMAND, CONTOUR, GROUP, height, MESH, name, POLYGON, SHAPE, SUBSHAPE, TRISTRIP, UNKNOWN, width |
Constructor Summary | |
---|---|
RShape()
Use this method to create a new empty shape. |
|
RShape(RPath newpath)
|
|
RShape(RPath[] newpaths)
|
|
RShape(RPoint[][] points)
|
|
RShape(RShape s)
|
Method Summary | |
---|---|
void |
adapt(RShape shp)
|
void |
adapt(RShape shp,
float wght,
float lngthOffset)
Use this method to adapt a group of of figures to a shape. |
void |
addBezierTo(float cp1x,
float cp1y,
float cp2x,
float cp2y,
float endx,
float endy)
Use this method to add a new bezierTo command to the current path. |
void |
addBezierTo(RPoint p1,
RPoint p2,
RPoint p3)
|
void |
addChild()
|
void |
addChild(RShape s)
|
void |
addClose()
|
void |
addLineTo(float endx,
float endy)
Use this method to add a new lineTo command to the current path. |
void |
addLineTo(RPoint p)
|
void |
addMoveTo(float endx,
float endy)
Use this method to add a new moveTo command to the shape. |
void |
addMoveTo(RPoint p)
|
void |
addPath()
|
void |
addPath(RPath s)
Use this method to create a new path. |
void |
addQuadTo(float cp1x,
float cp1y,
float endx,
float endy)
Use this method to add a new quadTo command to the current path. |
void |
addQuadTo(RPoint p1,
RPoint p2)
|
void |
addShape(RShape s)
Use this method to add a new shape. |
boolean |
contains(float x,
float y)
Use this to return a specific tangent on the curve. |
boolean |
contains(RPoint p)
Use this to return a specific tangent on the curve. |
int |
countChildren()
|
int |
countPaths()
Use this method to count the number of paths in the polygon. |
static RShape |
createCircle(float x,
float y,
float d)
|
static RShape |
createEllipse(float x,
float y,
float w,
float h)
Use this method to create a new elliptical shape. |
static RShape |
createLine(float x1,
float y1,
float x2,
float y2)
Use this method to create a new line. |
static RShape |
createRectangle(float x,
float y,
float w,
float h)
Use this method to create a new circle shape. |
static RShape |
createRing(float x,
float y,
float widthBig,
float widthSmall)
Use this method to create a new ring polygon. |
static RShape |
createStar(float x,
float y,
float widthBig,
float widthSmall,
int spikes)
Use this method to create a new starform polygon. |
RShape |
diff(RShape p)
Use this method to get the difference of the given polygon with the polygon passed as atribute. |
void |
draw(processing.core.PApplet g)
|
void |
draw(processing.core.PGraphics g)
|
RPoint |
getCentroid()
Use this method to get the centroid of the element. |
RShape |
getChild(java.lang.String target)
Extracts a shape by its name. |
RClosest |
getClosest(RShape other)
Use this method to get the closest or intersection points of the shape with another shape passed as argument. |
RPoint[] |
getHandles()
Use this to return the start, control and end points of the shape. |
RPoint[][] |
getHandlesInPaths()
|
RPoint[] |
getIntersections(RShape other)
Use this method to get the intersection points of the shape with another shape passed as argument. |
RPoint |
getPoint(float t)
Use this to return a point on the curve given a certain advancement. |
RPoint[] |
getPoints()
Use this to return the points on the curve of the shape. |
RPoint[][] |
getPointsInPaths()
Use this to return the points of each path of the group. |
RPoint |
getTangent(float t)
Use this to return a point on the curve given a certain advancement. |
RPoint[] |
getTangents()
Use this to return the points on the curve of the shape. |
RPoint[][] |
getTangentsInPaths()
|
int |
getType()
Use this method to get the type of element this is. |
void |
insertHandle(float t)
Use this to insert a split point into the shape. |
void |
insertHandleInPaths(float t)
Use this to insert a split point into each command of the shape. |
RShape |
intersection(RShape p)
Use this method to get the intersection of the given polygon with the polygon passed as atribute. |
void |
polygonize()
|
void |
print()
|
void |
setPath(int indPath)
Use this method to set the current path. |
RShape[] |
split(float t)
|
RShape[] |
splitPaths(float t)
|
RMesh |
toMesh()
Use this method to create a new mesh from a given polygon. |
RPolygon |
toPolygon()
Use this method to create a new polygon from a given shape. |
RShape |
toShape()
|
RShape |
union(RShape p)
Use this method to get the union of the given polygon with the polygon passed as atribute. |
RShape |
xor(RShape p)
Use this method to get the xor of the given polygon with the polygon passed as atribute. |
Methods inherited from class geomerative.RGeomElem |
---|
centerIn, centerIn, centerIn, contains, contains, containsBounds, containsHandles, draw, getArea, getBottomLeft, getBottomRight, getBounds, getBoundsPoints, getCenter, getCenteringTransf, getCenteringTransf, getCenteringTransf, 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 |
---|
public int type
public RPath[] paths
public RShape[] children
Constructor Detail |
---|
public RShape()
public RShape(RPath newpath)
public RShape(RPath[] newpaths)
public RShape(RPoint[][] points)
public RShape(RShape s)
Method Detail |
---|
public static RShape createLine(float x1, float y1, float x2, float y2)
x1
- x coordinate of the first point of the liney1
- y coordinate of the first point of the linex2
- x coordinate of the last point of the liney2
- y coordinate of the last point of the line
public static RShape createRing(float x, float y, float widthBig, float widthSmall)
x
- x coordinate of the center of the shapey
- y coordinate of the center of the shapewidthBig
- the outter width of the ring polygonwidthSmall
- the inner width of the ring polygon
public static RShape createStar(float x, float y, float widthBig, float widthSmall, int spikes)
widthBig
- the outter width of the star polygonwidthSmall
- the inner width of the star polygonspikes
- the amount of spikes on the star polygon
public static RShape createRectangle(float x, float y, float w, float h)
x
- the x position of the rectangley
- the y position of the rectanglew
- the width of the rectangleh
- the height of the rectangle
public static RShape createEllipse(float x, float y, float w, float h)
x
- the x position of the ellipsey
- the y position of the ellipsew
- the width of the ellipseh
- the height of the ellipse
public static RShape createCircle(float x, float y, float d)
public RShape getChild(java.lang.String target)
public RPoint getCentroid()
getCentroid
in class RGeomElem
public int countPaths()
public int countChildren()
public void addShape(RShape s)
s
- RShape, the shape to be added.public void addPath(RPath s)
s
- the path to be added.public void addPath()
public void addChild()
public void addChild(RShape s)
public void setPath(int indPath)
public void addMoveTo(float endx, float endy)
endx
- the x coordinate of the first point for the new path.endy
- the y coordinate of the first point for the new path.public void addMoveTo(RPoint p)
public void addLineTo(float endx, float endy)
endx
- the x coordinate of the ending point of the line.endy
- the y coordinate of the ending point of the line.public void addLineTo(RPoint p)
public void addQuadTo(float cp1x, float cp1y, float endx, float endy)
cp1x
- the x coordinate of the control point of the bezier.cp1y
- the y coordinate of the control point of the bezier.endx
- the x coordinate of the ending point of the bezier.endy
- the y coordinate of the ending point of the bezier.public void addQuadTo(RPoint p1, RPoint p2)
public void addBezierTo(float cp1x, float cp1y, float cp2x, float cp2y, float endx, float endy)
cp1x
- the x coordinate of the first control point of the bezier.cp1y
- the y coordinate of the first control point of the bezier.cp2x
- the x coordinate of the second control point of the bezier.cp2y
- the y coordinate of the second control point of the bezier.endx
- the x coordinate of the ending point of the bezier.endy
- the y coordinate of the ending point of the bezier.public void addBezierTo(RPoint p1, RPoint p2, RPoint p3)
public void addClose()
public RMesh toMesh()
toMesh
in class RGeomElem
public RPolygon toPolygon()
toPolygon
in class RGeomElem
public void polygonize()
public RShape toShape()
toShape
in class RGeomElem
public RShape intersection(RShape p)
p
- RShape, the polygon with which to perform the intersection
public RShape union(RShape p)
p
- RShape, the polygon with which to perform the union
public RShape xor(RShape p)
p
- RShape, the polygon with which to perform the xor
public RShape diff(RShape p)
p
- RShape, the polygon with which to perform the difference
public RPoint[] getHandles()
getHandles
in class RGeomElem
public RPoint getPoint(float t)
getPoint
in class RGeomElem
public RPoint[] getPoints()
getPoints
in class RGeomElem
public RPoint getTangent(float t)
getTangent
in class RGeomElem
public boolean contains(float x, float y)
x
- the X coordinate of the point for which to test containement.y
- the Y coordinate of the point for which to test containement.
public boolean contains(RPoint p)
contains
in class RGeomElem
p
- the point for which to test containement..
public RPoint[] getTangents()
getTangents
in class RGeomElem
public RPoint[][] getPointsInPaths()
getPointsInPaths
in class RGeomElem
public RPoint[][] getHandlesInPaths()
getHandlesInPaths
in class RGeomElem
public RPoint[][] getTangentsInPaths()
getTangentsInPaths
in class RGeomElem
public RShape[] splitPaths(float t)
public void insertHandle(float t)
t
- the parameter of advancement on the curve. t must have values between 0 and 1.public void insertHandleInPaths(float t)
t
- the parameter of advancement on the curve. t must have values between 0 and 1.public RShape[] split(float t)
public RPoint[] getIntersections(RShape other)
other
- the path with which to check for intersectionspublic RClosest getClosest(RShape other)
other
- the path with which to check for intersectionspublic void adapt(RShape shp, float wght, float lngthOffset) throws java.lang.RuntimeException
shp
- the path to which to adapt
java.lang.RuntimeException
public void adapt(RShape shp) throws java.lang.RuntimeException
java.lang.RuntimeException
public int getType()
getType
in class RGeomElem
public void print()
print
in class RGeomElem
public void draw(processing.core.PGraphics g)
draw
in class RGeomElem
public void draw(processing.core.PApplet g)
draw
in class RGeomElem
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |