HE_Mesh  5.1.0
geomerative.RPath Class Reference
+ Inheritance diagram for geomerative.RPath:

Public Member Functions

 RPath ()
 
 RPath (final RPoint[] points)
 
 RPath (final float x, final float y)
 
 RPath (final RPoint p)
 
 RPath (final RPath s)
 
 RPath (final RCommand c)
 
int countCommands ()
 
RPoint[] getHandles ()
 
RPoint[] getPoints ()
 
RPoint[][] getPointsInPaths ()
 
RPoint[][] getHandlesInPaths ()
 
RPoint[][] getTangentsInPaths ()
 
RPoint[] getTangents ()
 
RPoint[] intersectionPoints (final RCommand other)
 
RPoint[] intersectionPoints (final RPath other)
 
RClosest closestPoints (final RCommand other)
 
RClosest closestPoints (final RPath other)
 
RPoint getPoint (final float t)
 
RPoint getTangent (final float t)
 
boolean contains (final RPoint p)
 
void insertHandle (final float t)
 
void insertHandleInPaths (final float t)
 
RPath[] split (final float t)
 
void polygonize ()
 
void draw (final PGraphics g)
 
void draw (final PApplet g)
 
void addCommand (final RCommand p)
 
void addBezierTo (final RPoint cp1, final RPoint cp2, final RPoint end)
 
void addBezierTo (final float cp1x, final float cp1y, final float cp2x, final float cp2y, final float endx, final float endy)
 
void addQuadTo (final RPoint cp1, final RPoint end)
 
void addQuadTo (final float cp1x, final float cp1y, final float endx, final float endy)
 
void addLineTo (final RPoint end)
 
void addLineTo (final float endx, final float endy)
 
void addClose ()
 
RPolygon toPolygon ()
 
RShape toShape ()
 
RMesh toMesh ()
 
int getType ()
 
- Public Member Functions inherited from geomerative.RGeomElem
abstract void draw (PGraphics g)
 
abstract void draw (PApplet g)
 
void draw ()
 
abstract RPoint getPoint (float t)
 
abstract RPoint getTangent (float t)
 
abstract RPoint[] getHandles ()
 
abstract RPoint[] getPoints ()
 
abstract RPoint[] getTangents ()
 
abstract RPoint[][] getHandlesInPaths ()
 
abstract RPoint[][] getPointsInPaths ()
 
abstract RPoint[][] getTangentsInPaths ()
 
abstract boolean contains (RPoint p)
 
abstract int getType ()
 
abstract RShape toShape ()
 
void print ()
 
void setFill (boolean _fill)
 
void setFill (int _fillColor)
 
void setFill (String str)
 
void setStroke (boolean _stroke)
 
void setStroke (int _strokeColor)
 
void setStroke (String str)
 
void setStrokeWeight (float value)
 
void setStrokeWeight (String str)
 
void setStrokeCap (String str)
 
void setStrokeJoin (String str)
 
void setStrokeAlpha (int opacity)
 
void setStrokeAlpha (String str)
 
void setFillAlpha (int opacity)
 
void setFillAlpha (String str)
 
void setAlpha (float opacity)
 
void setAlpha (int opacity)
 
void setAlpha (String str)
 
RStyle getStyle ()
 
void setStyle (RStyle s)
 
void setName (String str)
 
float[] getCurveLengths ()
 
float getCurveLength ()
 
RPolygon toPolygon ()
 
RMesh toMesh ()
 
void transform (RMatrix m)
 
void transform (float x, float y, float w, float h)
 
boolean isIn (PGraphics g)
 
boolean isIn (PApplet g)
 
RMatrix getCenteringTransf (PGraphics g) throws RuntimeException
 
RMatrix getCenteringTransf (PGraphics g, float margin) throws RuntimeException
 
void centerIn (PGraphics g)
 
void centerIn (PGraphics g, float margin)
 
void centerIn (PGraphics g, float margin, float sclDamping, float trnsDamping) throws RuntimeException
 
void rotate (float angle)
 
void scale (float sx, float sy)
 
void scale (float s)
 

Public Attributes

int type = RGeomElem.SUBSHAPE
 
- Public Attributes inherited from geomerative.RGeomElem
float width
 
float height
 
String name = ""
 

Protected Member Functions

void calculateCurveLengths ()
 
- Protected Member Functions inherited from geomerative.RGeomElem
void saveContext (PGraphics g)
 
void saveContext (PApplet p)
 
void saveContext ()
 
void restoreContext (PGraphics g)
 
void restoreContext (PApplet p)
 
void restoreContext ()
 
void setContext (PGraphics g)
 
void setContext (PApplet p)
 
void setContext ()
 
void setStyle (RGeomElem p)
 
void setStyle (String styleString)
 
void calculateCurveLengths ()
 
void updateOrigParams ()
 

Private Member Functions

void append (final RCommand nextcommand)
 
void insert (final RCommand newcommand, final int i) throws RuntimeException
 
void extract (final int i) throws RuntimeException
 

Related Functions

(Note that these are not member functions.)

RCommand[] commands
 
RPoint lastPoint
 
float[] indAndAdvAt (final float t)
 

Additional Inherited Members

- Static Public Attributes inherited from geomerative.RGeomElem
static final int SHAPE = 0
 
static final int SUBSHAPE = 1
 
static final int COMMAND = 2
 
static final int POLYGON = 3
 
static final int CONTOUR = 4
 
static final int MESH = 5
 
static final int TRISTRIP = 6
 
static final int GROUP = 7
 
static final int UNKNOWN = 8
 
- Protected Attributes inherited from geomerative.RGeomElem
float[] lenCurves
 
float lenCurve = -1F
 
RStyle style = new RStyle()
 

Detailed Description

RPath is a reduced interface for creating, holding and drawing contours. Paths are ordered lists of commands (RCommand) which define the outlines of shapes. Paths can be self-intersecting.

RPath Geometry

Constructor & Destructor Documentation

geomerative.RPath.RPath ( )

Create a new empty path.

RPath

geomerative.RPath.RPath ( final RPoint[]  points)

Create a new path, given an array of points.

RPath

Parameters
pointsthe points of the new path
geomerative.RPath.RPath ( final float  x,
final float  y 
)

Create a new path, given the coordinates of the first point.

RPath

Parameters
xx coordinate of the first point of the new path
yy coordinate of the first point of the new path
geomerative.RPath.RPath ( final RPoint  p)

Create a new path, given the first point.

RPath

Parameters
pfirst point of the new path
geomerative.RPath.RPath ( final RPath  s)

Copy a path.

RPath

Parameters
spath to be copied
geomerative.RPath.RPath ( final RCommand  c)

Member Function Documentation

void geomerative.RPath.addBezierTo ( final RPoint  cp1,
final RPoint  cp2,
final RPoint  end 
)

Add a new cubic bezier to the path. The first point of the bezier will be the last point added to the path.

addBezierTo

Parameters
cp1first control point
cp2second control point
endend point
void geomerative.RPath.addBezierTo ( final float  cp1x,
final float  cp1y,
final float  cp2x,
final float  cp2y,
final float  endx,
final float  endy 
)

Add a new cubic bezier to the path. The first point of the bezier will be the last point added to the path.

addBezierTo

Parameters
cp1xthe x coordinate of the first control point
cp1ythe y coordinate of the first control point
cp2xthe x coordinate of the second control point
cp2ythe y coordinate of the second control point
endxthe x coordinate of the end point
endythe y coordinate of the end point
void geomerative.RPath.addClose ( )
void geomerative.RPath.addCommand ( final RCommand  p)

Use this method to add new commands to the contour.

addCommand

void geomerative.RPath.addLineTo ( final RPoint  end)

Add a new line to the path. The first point of the line will be the last point added to the path.

addLineTo

Parameters
endend point
void geomerative.RPath.addLineTo ( final float  endx,
final float  endy 
)

Add a new line to the path. The first point of the line will be the last point added to the path.

addLineTo

Parameters
endxthe x coordinate of the end point
endythe y coordinate of the end point
void geomerative.RPath.addQuadTo ( final RPoint  cp1,
final RPoint  end 
)

Add a new quadratic bezier to the path. The first point of the bezier will be the last point added to the path.

addQuadTo

Parameters
cp1first control point
endend point
void geomerative.RPath.addQuadTo ( final float  cp1x,
final float  cp1y,
final float  endx,
final float  endy 
)

Add a new quadratic bezier to the path. The first point of the bezier will be the last point added to the path.

addQuadTo

Parameters
cp1xthe x coordinate of the first control point
cp1ythe y coordinate of the first control point
endxthe x coordinate of the end point
endythe y coordinate of the end point
void geomerative.RPath.append ( final RCommand  nextcommand)
private
void geomerative.RPath.calculateCurveLengths ( )
protected
RClosest geomerative.RPath.closestPoints ( final RCommand  other)

Use this to find the closest or intersection points between this path and a command.

Returns
RPoint[], the intersection points returned in an array.
RClosest geomerative.RPath.closestPoints ( final RPath  other)

Use this to return the intersection points between two paths. Returns null if no intersection exists.

Returns
RPoint[], the intersection points returned in an array.
boolean geomerative.RPath.contains ( final RPoint  p)

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

Parameters
pthe point for which to test containement..
Returns
boolean, true if the point is in the path.
int geomerative.RPath.countCommands ( )

Use this method to count the number of commands in the contour.

countCommands

Returns
int, the number commands in the contour
void geomerative.RPath.draw ( final PGraphics  g)

Use this method to draw the path.

drawPath

Parameters
gPGraphics, the graphics object on which to draw the path
void geomerative.RPath.draw ( final PApplet  g)
void geomerative.RPath.extract ( final int  i) throws RuntimeException
private
RPoint [] geomerative.RPath.getHandles ( )

Use this to return the start, control and end points of the path. It returns the points in the way of an array of RPoint.

getHandles

Returns
RPoint[], the start, control and end points returned in an array.
RPoint [][] geomerative.RPath.getHandlesInPaths ( )

Use this to return the handles of each path of the path. It returns the handles in the way of an array of array of RPoint.

RGroup_getHandles

Returns
RPoint[], the handles returned in an array.
RPoint geomerative.RPath.getPoint ( final float  t)

Return a specific point on the curve. It returns the RPoint for a given advancement parameter t on the curve.

getPoint

Parameters
tthe parameter of advancement on the curve. t must have values between 0 and 1.
Returns
RPoint, the vertice returned.
RPoint [] geomerative.RPath.getPoints ( )

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

getPoints

Returns
RPoint[], the vertices returned in an array.
RPoint [][] geomerative.RPath.getPointsInPaths ( )

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

RGroup_getPoints

Returns
RPoint[], the points returned in an array.
RPoint geomerative.RPath.getTangent ( final float  t)

Use this to return a specific tangent on the curve. It returns the RPoint tangent for a given advancement parameter t on the curve.

getPoint

Parameters
tfloat, the parameter of advancement on the curve. t must have values between 0 and 1.
Returns
RPoint, the vertice returned.
RPoint [] geomerative.RPath.getTangents ( )

Use this to return the tangents on the curve. It returns the vectors in the way of an array of RPoint.

getTangents

Returns
RPoint[], the tangent vectors returned in an array.
RPoint [][] geomerative.RPath.getTangentsInPaths ( )

Use this to return the tangents of each path of the path. It returns the tangents in the way of an array of array of RPoint.

RGroup_getTangents

Returns
RPoint[], the tangents returned in an array.
int geomerative.RPath.getType ( )

Use this method to get the type of element this is.

RPolygon_getType

Returns
int, will allways return RGeomElem.POLYGON
void geomerative.RPath.insert ( final RCommand  newcommand,
final int  i 
) throws RuntimeException
private
void geomerative.RPath.insertHandle ( final float  t)

Use this to insert a split point into the path.

insertHandle

Parameters
tfloat, the parameter of advancement on the curve. t must have values between 0 and 1.
void geomerative.RPath.insertHandleInPaths ( final float  t)

Use this to insert a split point into each command of the path.

insertHandleInPaths

Parameters
tfloat, the parameter of advancement on the curve. t must have values between 0 and 1.
RPoint [] geomerative.RPath.intersectionPoints ( final RCommand  other)

Use this to return the intersection points between this path and a command. Returns null if no intersection exists.

Returns
RPoint[], the intersection points returned in an array.
RPoint [] geomerative.RPath.intersectionPoints ( final RPath  other)

Use this to return the intersection points between two paths. Returns null if no intersection exists.

Returns
RPoint[], the intersection points returned in an array.
void geomerative.RPath.polygonize ( )
RPath [] geomerative.RPath.split ( final float  t)

Use this to split a path into two separate new paths.

split

Parameters
tfloat, the parameter of advancement on the curve. t must have values between 0 and 1.
Returns
RPath[], an array of two RPath.
RMesh geomerative.RPath.toMesh ( )
RPolygon geomerative.RPath.toPolygon ( )
RShape geomerative.RPath.toShape ( )

Friends And Related Function Documentation

RCommand [] commands
related

Array of RCommand objects holding the commands of the path.

commands

( )

float [] indAndAdvAt ( final float  t)
related

Use this method to transform the shape.

RPath_transform

Parameters
mRMatrix, the matrix defining the affine transformation ( )
RPoint lastPoint
related

Last point from where to add the next command. Initialized to (0, 0).

lastPoint

Member Data Documentation

int geomerative.RPath.type = RGeomElem.SUBSHAPE

The documentation for this class was generated from the following file: