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

Public Member Functions

 RCommand ()
 
 RCommand (RCommand c)
 
 RCommand (RCommand c, RPoint sp)
 
 RCommand (RPoint sp, RPoint ep)
 
 RCommand (float spx, float spy, float epx, float epy)
 
 RCommand (RPoint sp, RPoint cp1, RPoint ep)
 
 RCommand (float spx, float spy, float cp1x, float cp1y, float epx, float epy)
 
 RCommand (RPoint sp, RPoint cp1, RPoint cp2, RPoint ep)
 
 RCommand (float spx, float spy, float cp1x, float cp1y, float cp2x, float cp2y, float epx, float epy)
 
RShape toShape ()
 
int getType ()
 
int countControlPoints ()
 
int getCommandType ()
 
RPoint[] getPoints ()
 
RPoint getPoint (float t)
 
RPoint[] getTangents (int segments)
 
RPoint[] getTangents ()
 
RPoint getTangent (float t)
 
float getCurveLength (float t)
 
float getCurveLength ()
 
RPoint[][] getPointsInPaths ()
 
RPoint[][] getHandlesInPaths ()
 
RPoint[][] getTangentsInPaths ()
 
boolean contains (RPoint p)
 
void draw (PGraphics g)
 
void draw (PApplet a)
 
RPoint[] getHandles ()
 
RCommand[] split (float t)
 
RPoint[] intersectionPoints (RCommand other)
 
RClosest closestPoints (RCommand other)
 
- 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)
 

Static Public Member Functions

static void setSegmentator (int segmentatorType)
 
static void setSegmentGraphic (PGraphics g)
 
static void setSegmentAngle (float segmentAngleTolerance)
 
static void setSegmentLength (float segmentLngth)
 
static void setSegmentOffset (float segmentOffst)
 
static void setSegmentStep (float segmentStps)
 
static RPoint[] lineLineIntersection (RCommand c1, RCommand c2)
 
static RPoint[] lineQuadIntersection (RCommand c1, RCommand c2)
 
static RPoint[] lineCubicIntersection (RCommand c1, RCommand c2)
 
static RPoint[] quadQuadIntersection (RCommand c1, RCommand c2)
 
static RPoint[] quadCubicIntersection (RCommand c1, RCommand c2)
 
static RPoint[] cubicCubicIntersection (RCommand c1, RCommand c2)
 
static float closestAdvFrom (RCommand c, RPoint p)
 
static RClosest lineLineClosest (RCommand c1, RCommand c2)
 
static RClosest lineQuadClosest (RCommand c1, RCommand c2)
 
static RClosest lineCubicClosest (RCommand c1, RCommand c2)
 
static RClosest quadQuadClosest (RCommand c1, RCommand c2)
 
static RClosest quadCubicClosest (RCommand c1, RCommand c2)
 
static RClosest cubicCubicClosest (RCommand c1, RCommand c2)
 

Public Attributes

int type = RGeomElem.COMMAND
 
RPoint[] controlPoints
 
RPoint startPoint
 
RPoint endPoint
 
- Public Attributes inherited from geomerative.RGeomElem
float width
 
float height
 
String name = ""
 

Static Public Attributes

static final int LINETO = 0
 
static final int QUADBEZIERTO = 1
 
static final int CUBICBEZIERTO = 2
 
static final int ADAPTATIVE = 0
 
static final int UNIFORMLENGTH = 1
 
static final int UNIFORMSTEP = 2
 
static int segmentType = UNIFORMLENGTH
 
static float segmentAngleTol = 0.0F
 
- 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 Member Functions

void saveSegmentatorContext ()
 
void restoreSegmentatorContext ()
 
RPoint[] getPoints (boolean resetSegmentator)
 
- 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

RCommand[] splitCubicBezier (float t)
 
RCommand[] splitQuadBezier (float t)
 
RCommand[] splitLine (float t)
 
void quadBezierAdaptative ()
 
void quadBezierAdaptativeRecursive (float x1, float y1, float x2, float y2, float x3, float y3, int level)
 
void cubicBezierAdaptative ()
 
void cubicBezierAdaptativeRecursive (float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4, int level)
 
void lineUniformStep ()
 
void cubicBezierUniformStep ()
 
void quadBezierUniformStep ()
 
void lineUniformLength ()
 
void quadBezierUniformLength ()
 
void cubicBezierUniformLength ()
 
float quadBezierLength ()
 
float cubicBezierLength ()
 
void append (RPoint nextcontrolpoint)
 
void addCurvePoint (RPoint nextcurvepoint)
 

Additional Inherited Members

- Protected Attributes inherited from geomerative.RGeomElem
float[] lenCurves
 
float lenCurve = -1F
 
RStyle style = new RStyle()
 

Detailed Description

Constructor & Destructor Documentation

geomerative.RCommand.RCommand ( )

Create an empty command

geomerative.RCommand.RCommand ( RCommand  c)

Make a copy of another RCommand object. This can be useful when wanting to transform one but at the same time keep the original.

Parameters
cthe object of which to make the copy
geomerative.RCommand.RCommand ( RCommand  c,
RPoint  sp 
)

Make a copy of another RCommand object with a specific start point.

Parameters
cthe object of which to make the copy
spthe start point of the command to be created
geomerative.RCommand.RCommand ( RPoint  sp,
RPoint  ep 
)

Create a LINETO command object with specific start and end points.

Parameters
spthe start point of the command to be created
epthe end point of the command to be created
geomerative.RCommand.RCommand ( float  spx,
float  spy,
float  epx,
float  epy 
)

Create a LINETO command object with specific start and end point coordinates.

Parameters
spxthe x coordinate of the start point of the command to be created
spythe y coordinate of the start point of the command to be created
epxthe x coordinate of the end point of the command to be created
epythe y coordinate of the end point of the command to be created
geomerative.RCommand.RCommand ( RPoint  sp,
RPoint  cp1,
RPoint  ep 
)

Create a QUADBEZIERTO command object with specific start, control and end point coordinates.

Parameters
spthe start point of the command to be created
cp1the first control point of the command to be created
epthe end point of the command to be created
geomerative.RCommand.RCommand ( float  spx,
float  spy,
float  cp1x,
float  cp1y,
float  epx,
float  epy 
)

Create a QUADBEZIERTO command object with specific start, control and end point coordinates.

Parameters
spxthe x coordinate of the start point of the command to be created
spythe y coordinate of the start point of the command to be created
cp1xthe x coordinate of the first control point of the command to be created
cp1ythe y coordinate of the first control point of the command to be created
epxthe x coordinate of the end point of the command to be created
epythe y coordinate of the end point of the command to be created
geomerative.RCommand.RCommand ( RPoint  sp,
RPoint  cp1,
RPoint  cp2,
RPoint  ep 
)

Create a CUBICBEZIERTO command object with specific start, control and end point coordinates.

Parameters
spthe start point of the command to be created
cp1the first control point of the command to be created
cp2the second control point of the command to be created
epthe end point of the command to be created
geomerative.RCommand.RCommand ( float  spx,
float  spy,
float  cp1x,
float  cp1y,
float  cp2x,
float  cp2y,
float  epx,
float  epy 
)

Create a CUBICBEZIERTO command object with specific start, control and end point coordinates.

Parameters
spxthe x coordinate of the start point of the command to be created
spythe y coordinate of the start point of the command to be created
cp1xthe x coordinate of the first control point of the command to be created
cp1ythe y coordinate of the first control point of the command to be created
cp2xthe x coordinate of the second control point of the command to be created
cp2ythe y coordinate of the second control point of the command to be created
epxthe x coordinate of the end point of the command to be created
epythe y coordinate of the end point of the command to be created

Member Function Documentation

void geomerative.RCommand.addCurvePoint ( RPoint  nextcurvepoint)
private
void geomerative.RCommand.append ( RPoint  nextcontrolpoint)
private

Use this method to transform the command. transformCommand

Parameters
gPGraphics, the graphics object on which to apply an affine transformation to the command
static float geomerative.RCommand.closestAdvFrom ( RCommand  c,
RPoint  p 
)
static
RClosest geomerative.RCommand.closestPoints ( RCommand  other)
boolean geomerative.RCommand.contains ( RPoint  p)
int geomerative.RCommand.countControlPoints ( )

Use this to return the number of control points of the curve. countControlPoints

Returns
int, the number of control points.
void geomerative.RCommand.cubicBezierAdaptative ( )
private
void geomerative.RCommand.cubicBezierAdaptativeRecursive ( float  x1,
float  y1,
float  x2,
float  y2,
float  x3,
float  y3,
float  x4,
float  y4,
int  level 
)
private
float geomerative.RCommand.cubicBezierLength ( )
private
void geomerative.RCommand.cubicBezierUniformLength ( )
private
void geomerative.RCommand.cubicBezierUniformStep ( )
private
static RClosest geomerative.RCommand.cubicCubicClosest ( RCommand  c1,
RCommand  c2 
)
static
static RPoint [] geomerative.RCommand.cubicCubicIntersection ( RCommand  c1,
RCommand  c2 
)
static
void geomerative.RCommand.draw ( PGraphics  g)

Use this method to draw the command. drawCommand

Parameters
gPGraphics, the graphics object on which to draw the command
void geomerative.RCommand.draw ( PApplet  a)

Use this method to draw the command. drawCommand

Parameters
athe applet object on which to draw the command
int geomerative.RCommand.getCommandType ( )

Use this to return the command type. getCommandType

Returns
int, an integer which can take the following values: RCommand.LINETO, RCommand.QUADBEZIERTO, RCommand.CUBICBEZIERTO.
float geomerative.RCommand.getCurveLength ( float  t)

Use this to return arc length of a curve. It returns the float representing the length given the value of the advancement parameter t on the curve. The current implementation of this function is very slow, not recommended for using during frame draw. RCommand_getCurveLength

Parameters
tfloat, the parameter of advancement on the curve. t must have values between 0 and 1.
Returns
float, the length returned.
float geomerative.RCommand.getCurveLength ( )

Use this to return arc length of a curve. It returns the float representing the length given the value of the advancement parameter t on the curve. The current implementation of this function is very slow, not recommended for using during frame draw. RCommand_getCurveLength

Returns
float, the length returned.
RPoint [] geomerative.RCommand.getHandles ( )

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

Returns
RPoint[], the vertices returned in an array.
RPoint [][] geomerative.RCommand.getHandlesInPaths ( )
RPoint geomerative.RCommand.getPoint ( float  t)

Use this to return a specific point on the curve. It returns the RPoint 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.RCommand.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.RCommand.getPoints ( boolean  resetSegmentator)
protected
RPoint [][] geomerative.RCommand.getPointsInPaths ( )
RPoint geomerative.RCommand.getTangent ( float  t)

Use this to return a specific tangent on the curve. It returns the RPoint representing the tangent vector for a given value of the advancement parameter t on the curve. getTangent

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

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

Parameters
segmentsint, the number of segments in which to divide the curve.
Returns
RPoint[], the tangent vectors returned in an array.
RPoint [] geomerative.RCommand.getTangents ( )
RPoint [][] geomerative.RCommand.getTangentsInPaths ( )
int geomerative.RCommand.getType ( )
RPoint [] geomerative.RCommand.intersectionPoints ( RCommand  other)
static RClosest geomerative.RCommand.lineCubicClosest ( RCommand  c1,
RCommand  c2 
)
static
static RPoint [] geomerative.RCommand.lineCubicIntersection ( RCommand  c1,
RCommand  c2 
)
static
static RClosest geomerative.RCommand.lineLineClosest ( RCommand  c1,
RCommand  c2 
)
static
static RPoint [] geomerative.RCommand.lineLineIntersection ( RCommand  c1,
RCommand  c2 
)
static
static RClosest geomerative.RCommand.lineQuadClosest ( RCommand  c1,
RCommand  c2 
)
static
static RPoint [] geomerative.RCommand.lineQuadIntersection ( RCommand  c1,
RCommand  c2 
)
static
void geomerative.RCommand.lineUniformLength ( )
private
void geomerative.RCommand.lineUniformStep ( )
private
void geomerative.RCommand.quadBezierAdaptative ( )
private
void geomerative.RCommand.quadBezierAdaptativeRecursive ( float  x1,
float  y1,
float  x2,
float  y2,
float  x3,
float  y3,
int  level 
)
private
float geomerative.RCommand.quadBezierLength ( )
private
void geomerative.RCommand.quadBezierUniformLength ( )
private
void geomerative.RCommand.quadBezierUniformStep ( )
private
static RClosest geomerative.RCommand.quadCubicClosest ( RCommand  c1,
RCommand  c2 
)
static
static RPoint [] geomerative.RCommand.quadCubicIntersection ( RCommand  c1,
RCommand  c2 
)
static
static RClosest geomerative.RCommand.quadQuadClosest ( RCommand  c1,
RCommand  c2 
)
static
static RPoint [] geomerative.RCommand.quadQuadIntersection ( RCommand  c1,
RCommand  c2 
)
static
void geomerative.RCommand.restoreSegmentatorContext ( )
protected
void geomerative.RCommand.saveSegmentatorContext ( )
protected
static void geomerative.RCommand.setSegmentAngle ( float  segmentAngleTolerance)
static

Use this to set the segmentator angle tolerance for the ADAPTATIVE segmentator and set the segmentator to ADAPTATIVE. setSegmentAngle

Parameters
segmentAngleTolerancean angle from 0 to PI/2 it defines the maximum angle between segments.
static void geomerative.RCommand.setSegmentator ( int  segmentatorType)
static

Use this to set the segmentator type. ADAPTATIVE segmentator minimizes the number of segments avoiding perceptual artifacts like angles or cusps. Use this in order to have Polygons and Meshes with the fewest possible vertices. This can be useful when using or drawing a lot the same Polygon or Mesh deriving from this Shape. UNIFORMLENGTH segmentator is the slowest segmentator and it segments the curve on segments of equal length. This can be useful for very specific applications when for example drawing incrementaly a shape with a uniform speed. UNIFORMSTEP segmentator is the fastest segmentator and it segments the curve based on a constant value of the step of the curve parameter, or on the number of segments wanted. This can be useful when segmpointsentating very often a Shape or when we know the amount of segments necessary for our specific application. setSegment

static void geomerative.RCommand.setSegmentGraphic ( PGraphics  g)
static

Use this to set the segmentator graphic context. setSegmentGraphic

Parameters
ggraphics object too which to adapt the segmentation of the command.
static void geomerative.RCommand.setSegmentLength ( float  segmentLngth)
static

Use this to set the segmentator length for the UNIFORMLENGTH segmentator and set the segmentator to UNIFORMLENGTH. setSegmentLength

Parameters
segmentLngththe length of each resulting segment.
static void geomerative.RCommand.setSegmentOffset ( float  segmentOffst)
static

Use this to set the segmentator offset for the UNIFORMLENGTH segmentator and set the segmentator to UNIFORMLENGTH. setSegmentOffset

Parameters
segmentOffstthe offset of the first point on the path.
static void geomerative.RCommand.setSegmentStep ( float  segmentStps)
static

Use this to set the segmentator step for the UNIFORMSTEP segmentator and set the segmentator to UNIFORMSTEP. setSegmentStep

Parameters
segmentStpsif a float from +0.0 to 1.0 is passed it's considered as the step, else it's considered as the number of steps. When a value of 0.0 is used the steps will be calculated automatically depending on an estimation of the length of the curve. The special value -1 is the same as 0.0 but also turning of the segmentation of lines (faster segmentation).
RCommand [] geomerative.RCommand.split ( float  t)

Returns two commands resulting of splitting the command. split

Parameters
tthe advancement on the curve where command should be split.
Returns
RPoint[], the tangent vectors returned in an array.
RCommand [] geomerative.RCommand.splitCubicBezier ( float  t)
private

Taken from: http://steve.hollasch.net/cgindex/curves/cbezarclen.html

who took it from: Schneider's Bezier curve-fitter

RCommand [] geomerative.RCommand.splitLine ( float  t)
private
RCommand [] geomerative.RCommand.splitQuadBezier ( float  t)
private
RShape geomerative.RCommand.toShape ( )

Member Data Documentation

final int geomerative.RCommand.ADAPTATIVE = 0
static
RPoint [] geomerative.RCommand.controlPoints
final int geomerative.RCommand.CUBICBEZIERTO = 2
static
RPoint geomerative.RCommand.endPoint
final int geomerative.RCommand.LINETO = 0
static
final int geomerative.RCommand.QUADBEZIERTO = 1
static
float geomerative.RCommand.segmentAngleTol = 0.0F
static
int geomerative.RCommand.segmentType = UNIFORMLENGTH
static
RPoint geomerative.RCommand.startPoint
int geomerative.RCommand.type = RGeomElem.COMMAND
final int geomerative.RCommand.UNIFORMLENGTH = 1
static
final int geomerative.RCommand.UNIFORMSTEP = 2
static

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