geomerative
public class RShape extends RGeomElem
Modifier and Type | Field and Description |
---|---|
RShape[] |
children |
RPath[] |
paths
Array of RPath objects holding the paths of the polygon.
|
int |
type |
Constructor and Description |
---|
RShape()
Use this method to create a new empty shape.
|
RShape(RPath newpath) |
RShape(RPath[] newpaths) |
RShape(RPoint[][] points) |
RShape(RShape s) |
Modifier and Type | Method and Description |
---|---|
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 shape.
|
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 between this polygon and the polygon passed in as a parameter.
|
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 points of intersection between this shape and another shape passed in as a parameter.
|
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 this polygon with the polygon passed in as a parameter.
|
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 this polygon with the polygon passed in as a parameter.
|
RShape |
xor(RShape p)
Use this method to get the xor of this polygon with the polygon passed in as a parameter.
|
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
public int type
public RPath[] paths
public RShape[] children
public RShape()
public RShape(RPath newpath)
public RShape(RPath[] newpaths)
public RShape(RPoint[][] points)
public RShape(RShape s)
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 linepublic 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 outer width of the ring polygonwidthSmall
- the inner width of the ring polygonpublic static RShape createStar(float x, float y, float widthBig, float widthSmall, int spikes)
widthBig
- the outer width of the star polygonwidthSmall
- the inner width of the star polygonspikes
- the amount of spikes on the star polygonpublic 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 rectanglepublic 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 ellipsepublic 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 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 addClose()
public RMesh toMesh()
public RPolygon toPolygon()
public void polygonize()
public RShape intersection(RShape p)
p
- RShape, the polygon with which to perform the intersectionpublic RShape union(RShape p)
p
- RShape, the polygon with which to perform the unionpublic RShape xor(RShape p)
p
- RShape, the polygon with which to perform the xorpublic RShape diff(RShape p)
p
- RShape, the polygon with which to perform the differencepublic RPoint[] getHandles()
getHandles
in class RGeomElem
public RPoint getPoint(float t)
public RPoint[] getPoints()
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 containment.y
- the Y coordinate of the point for which to test containment.public boolean contains(RPoint p)
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 adaptjava.lang.RuntimeException
public void adapt(RShape shp) throws java.lang.RuntimeException
java.lang.RuntimeException
public int getType()
Geomerative by Ricard Marxer, http://www.ricardmarxer.com/geomerative/