geomerative
Class RMesh

java.lang.Object
  extended by geomerative.RGeomElem
      extended by geomerative.RMesh

public class RMesh
extends RGeomElem

RMesh is a reduced interface for creating, holding and drawing meshes. Meshes are a group of tiangle strips (RStrip).


Field Summary
 RStrip[] strips
          Array of RStrip objects holding the contours 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
RMesh()
          Create a new empty mesh.
RMesh(RMesh m)
          Copy a mesh.
 
Method Summary
 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
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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 added
y - 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 added
p - 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 added
x - the x coordinate of the point to be added
y - the y coordinate of the point to be added

draw

public void draw(processing.core.PGraphics g)
Use this method to draw the mesh.

Specified by:
draw in class RGeomElem
Parameters:
g - PGraphics, the graphics object on which to draw the mesh

draw

public void draw(processing.core.PApplet g)
Specified by:
draw in class RGeomElem

getHandles

public RPoint[] getHandles()
Use this to get the vertices of the mesh. It returns the points in the way of an array of RPoint.

Specified by:
getHandles in class RGeomElem
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 in the way of an array of RPoint.

Specified by:
getPoints in class RGeomElem
Returns:
RPoint[], the vertices returned in an array.

getPoint

public RPoint getPoint(float t)
Specified by:
getPoint in class RGeomElem

getTangent

public RPoint getTangent(float t)
Specified by:
getTangent in class RGeomElem

getTangents

public RPoint[] getTangents()
Specified by:
getTangents in class RGeomElem

getPointsInPaths

public RPoint[][] getPointsInPaths()
Specified by:
getPointsInPaths in class RGeomElem

getHandlesInPaths

public RPoint[][] getHandlesInPaths()
Specified by:
getHandlesInPaths in class RGeomElem

getTangentsInPaths

public RPoint[][] getTangentsInPaths()
Specified by:
getTangentsInPaths in class RGeomElem

contains

public boolean contains(RPoint p)
Specified by:
contains in class RGeomElem

getType

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

Specified by:
getType in class RGeomElem
Returns:
int, will allways return RGeomElem.MESH

transform

public void transform(RMatrix m)
Use this method to transform the mesh.

Overrides:
transform in class RGeomElem
Parameters:
m - RMatrix, the matrix of the affine transformation to apply to the mesh

toMesh

public RMesh toMesh()
Overrides:
toMesh in class RGeomElem

toPolygon

public RPolygon toPolygon()
                   throws java.lang.RuntimeException
Overrides:
toPolygon in class RGeomElem
Throws:
java.lang.RuntimeException

toShape

public RShape toShape()
               throws java.lang.RuntimeException
Specified by:
toShape in class RGeomElem
Throws:
java.lang.RuntimeException


Geomerative by Ricard Marxer, http://www.ricardmarxer.com/geomerative/