Package geomerative
Class RMesh
- java.lang.Object
-
- geomerative.RGeomElem
-
- geomerative.RMesh
-
public class RMesh extends RGeomElem
RMesh is a reduced interface for creating, holding and drawing meshes. A mesh is a group of triangular strips (RStrip).
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addPoint(float x, float y)
Add a new point to the current strip.void
addPoint(int indStrip, float x, float y)
Add a new point to the given strip.void
addPoint(int indStrip, RPoint p)
Add a new point to the given strip.void
addPoint(RPoint p)
Add a new point to the current strip.void
addStrip()
void
addStrip(RStrip s)
Add a new strip.boolean
contains(RPoint p)
int
countStrips()
Use this method to count the number of strips in the mesh.void
draw(processing.core.PApplet g)
void
draw(processing.core.PGraphics g)
Use this method to draw the mesh.RPoint[]
getHandles()
Use this to get the vertices of the mesh.RPoint[][]
getHandlesInPaths()
RPoint
getPoint(float t)
RPoint[]
getPoints()
Use this to get the vertices of the mesh.RPoint[][]
getPointsInPaths()
RPoint
getTangent(float t)
RPoint[]
getTangents()
RPoint[][]
getTangentsInPaths()
int
getType()
Use this method to get the type of element this is.void
setCurrent(int indStrip)
Use this method to set the current strip to which append points.RMesh
toMesh()
RPolygon
toPolygon()
RShape
toShape()
void
transform(RMatrix m)
Use this method to transform the mesh.-
Methods inherited from class geomerative.RGeomElem
centerIn, centerIn, centerIn, contains, contains, containsBounds, containsHandles, draw, getArea, getBottomLeft, getBottomRight, getBounds, getBoundsPoints, getCenter, getCenteringTransf, getCenteringTransf, getCenteringTransf, getCentroid, getCurveLength, getCurveLengths, getHeight, getOrigHeight, getOrigWidth, getStyle, getTopLeft, getTopRight, getWidth, getX, getY, intersects, intersects, intersectsBounds, intersectsHandles, isIn, isIn, print, 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, translate, translate
-
-
-
-
Field Detail
-
type
public int type
-
strips
public RStrip[] strips
Array of RStrip objects holding the contours of the polygon.
-
-
Constructor Detail
-
RMesh
public RMesh()
Create a new empty mesh.
-
RMesh
public RMesh(RMesh m)
Copy a mesh.- Parameters:
m
- the object of which to make a copy
-
-
Method Detail
-
countStrips
public int countStrips()
Use this method to count the number of strips in the mesh.- Returns:
- int, the number strips in the mesh
-
addStrip
public void addStrip(RStrip s)
Add a new strip.- Parameters:
s
- the strip to be added
-
addStrip
public void addStrip()
-
setCurrent
public void setCurrent(int indStrip)
Use this method to set the current strip to which append points.
-
addPoint
public void addPoint(RPoint p)
Add a new point to the current strip.- Parameters:
p
- the point to be added
-
addPoint
public void addPoint(float x, float y)
Add a new point to the current strip.- Parameters:
x
- the x coordinate of the point to be addedy
- the y coordinate of the point to be added
-
addPoint
public void addPoint(int indStrip, RPoint p)
Add a new point to the given strip.- Parameters:
indStrip
- the index of the strip to which the point will be addedp
- the point to be added
-
addPoint
public void addPoint(int indStrip, float x, float y)
Add a new point to the given strip.- Parameters:
indStrip
- the index of the strip to which the point will be addedx
- the x coordinate of the point to be addedy
- the y coordinate of the point to be added
-
draw
public void draw(processing.core.PGraphics g)
Use this method to draw the mesh.
-
getHandles
public RPoint[] getHandles()
Use this to get the vertices of the mesh. It returns the points as an array of RPoint.- Specified by:
getHandles
in classRGeomElem
- Returns:
- RPoint[], the vertices returned in an array.
-
getPoints
public RPoint[] getPoints()
Use this to get the vertices of the mesh. It returns the points as an array of RPoint.
-
getTangent
public RPoint getTangent(float t)
- Specified by:
getTangent
in classRGeomElem
-
getTangents
public RPoint[] getTangents()
- Specified by:
getTangents
in classRGeomElem
-
getPointsInPaths
public RPoint[][] getPointsInPaths()
- Specified by:
getPointsInPaths
in classRGeomElem
-
getHandlesInPaths
public RPoint[][] getHandlesInPaths()
- Specified by:
getHandlesInPaths
in classRGeomElem
-
getTangentsInPaths
public RPoint[][] getTangentsInPaths()
- Specified by:
getTangentsInPaths
in classRGeomElem
-
getType
public int getType()
Use this method to get the type of element this is.
-
transform
public void transform(RMatrix m)
Use this method to transform the mesh.
-
toPolygon
public RPolygon toPolygon() throws java.lang.RuntimeException
-
-