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

Classes

class  FontNotLoadedException
 
class  LibraryNotInitializedException
 
class  NoPathInitializedException
 

Static Public Member Functions

static RFont loadFont (String fontFile)
 
static void text (String text)
 
static void textFont (RFont font, int size)
 
static RShape getText (String text, String font, int size, int align)
 
static RShape getText (String text)
 
static void shape (RShape shp, float x, float y, float w, float h)
 
static void shape (RShape shp, float x, float y)
 
static void shape (RShape shp)
 
static RShape createShape (RPoint[][] points)
 
static RShape loadShape (String filename)
 
static void saveShape (String filename, RShape shape)
 
static void beginShape ()
 
static void breakShape (int endMode)
 
static void breakShape ()
 
static void vertex (float x, float y)
 
static void bezierVertex (float cx1, float cy1, float cx2, float cy2, float x, float y)
 
static void endShape (PGraphics g)
 
static void endShape ()
 
static RShape getShape ()
 
static RShape getEllipse (float x, float y, float w, float h)
 
static RShape getEllipse (float x, float y, float w)
 
static RShape getLine (float x1, float y1, float x2, float y2)
 
static RShape getRect (float x, float y, float w, float h)
 
static RShape getRect (float x, float y, float w)
 
static RShape getStar (float x, float y, float widthBig, float widthSmall, int spikes)
 
static RShape getRing (float x, float y, float widthBig, float widthSmall)
 
static RShape centerIn (RShape grp, PGraphics g, float margin)
 
static RShape centerIn (RShape grp, PGraphics g)
 
static RShape[] split (RShape shp, float t)
 
static void init (PApplet _parent)
 
static boolean initialized ()
 
static void setDpi (int _dpi)
 
static void ignoreStyles (boolean value)
 
static void ignoreStyles ()
 
static void setAdaptorScale (float adptorScale)
 
static void setAdaptorLengthOffset (float adptorLengthOffset) throws RuntimeException
 

Static Public Attributes

static boolean ignoreStyles = false
 
static boolean useFastClip = true
 
static final int BYPOINT = 0
 
static final int BYELEMENTPOSITION = 1
 
static final int BYELEMENTINDEX = 2
 
static int ADAPTATIVE = RCommand.ADAPTATIVE
 
static int UNIFORMLENGTH = RCommand.UNIFORMLENGTH
 
static int UNIFORMSTEP = RCommand.UNIFORMSTEP
 

Static Protected Member Functions

static PApplet parent ()
 
static int dpi ()
 

Static Private Attributes

static boolean initialized = false
 
static PApplet parent
 

Related Functions

(Note that these are not member functions.)

static RShape adapt (RShape shp, RShape path)
 
static RShape polygonize (RShape shp)
 
static RShape diff (RShape a, RShape b)
 
static RShape union (RShape a, RShape b)
 
static RShape intersection (RShape a, RShape b)
 
static RShape xor (RShape a, RShape b)
 
static void setAdaptor (int adptorType)
 
static void setPolygonizer (int segmenterMethod)
 
static void setPolygonizerAngle (float angle)
 
static void setPolygonizerLength (float length)
 
static void setPolygonizerStep (float step)
 

Detailed Description

RG is a static class containing all the states, modes, etc.. Geomerative is mostly used by calling RG methods. e.g. RShape s = RG.getEllipse(30, 40, 80, 80)

Member Function Documentation

static void geomerative.RG.beginShape ( )
static

Begin to create a shape. createShape

static void geomerative.RG.bezierVertex ( float  cx1,
float  cy1,
float  cx2,
float  cy2,
float  x,
float  y 
)
static

Add a bezierVertex to the shape. Can only be called inside beginShape() and endShape(). createShape

Parameters
cx1the x coordinate of the first control point
cy1the y coordinate of the first control point
cx2the x coordinate of the second control point
cy2the y coordinate of the second control point
xthe x coordinate of the end point
ythe y coordinate of the end point
static void geomerative.RG.breakShape ( int  endMode)
static

Begin a new path in the current shape. Can only be called inside beginShape() and endShape().

Parameters
endModeif called with RG.CLOSE it closes the current path before starting the new one. createShape
static void geomerative.RG.breakShape ( )
static
static RShape geomerative.RG.centerIn ( RShape  grp,
PGraphics  g,
float  margin 
)
static
static RShape geomerative.RG.centerIn ( RShape  grp,
PGraphics  g 
)
static
static RShape geomerative.RG.createShape ( RPoint  points[][])
static

Create a shape from an array of point arrays. createShape

static int geomerative.RG.dpi ( )
staticprotected
static void geomerative.RG.endShape ( PGraphics  g)
static

End the shape being created and draw it to the screen or the PGraphics passed as parameter. createShape

Parameters
gthe canvas on which to draw. By default it draws on the screen
static void geomerative.RG.endShape ( )
static
static RShape geomerative.RG.getEllipse ( float  x,
float  y,
float  w,
float  h 
)
static

Get an ellipse as a shape object. getEllipse

Parameters
xx coordinate of the center of the shape
yy coordinate of the center of the shape
wwidth of the ellipse
hheight of the ellipse
Returns
RShape, the shape created
static RShape geomerative.RG.getEllipse ( float  x,
float  y,
float  w 
)
static
static RShape geomerative.RG.getLine ( float  x1,
float  y1,
float  x2,
float  y2 
)
static

Get a line as a shape object. getLine

Parameters
x1x coordinate of the first point of the line
y1y coordinate of the first point of the line
x2x coordinate of the last point of the line
y2y coordinate of the last point of the line
Returns
RShape, the shape created
static RShape geomerative.RG.getRect ( float  x,
float  y,
float  w,
float  h 
)
static

Get an rectangle as a shape object. getRect

Parameters
xx coordinate of the top left corner of the shape
yy coordinate of the top left of the shape
wwidth of the rectangle
hheight of the rectangle
Returns
RShape, the shape created
static RShape geomerative.RG.getRect ( float  x,
float  y,
float  w 
)
static
static RShape geomerative.RG.getRing ( float  x,
float  y,
float  widthBig,
float  widthSmall 
)
static

Get a ring as a shape object. getRing

Parameters
xx coordinate of the center of the shape
yy coordinate of the center of the shape
widthBigthe outter width of the ring polygon
widthSmallthe inner width of the ring polygon
Returns
RShape, the shape created
static RShape geomerative.RG.getShape ( )
static

End the shape being created and get it as an object. getShape

static RShape geomerative.RG.getStar ( float  x,
float  y,
float  widthBig,
float  widthSmall,
int  spikes 
)
static

Get a star as a shape object. getStar

Parameters
xx coordinate of the center of the shape
yy coordinate of the center of the shape
widthBigthe outter width of the star polygon
widthSmallthe inner width of the star polygon
spikesthe amount of spikes on the star polygon
Returns
RShape, the shape created
static RShape geomerative.RG.getText ( String  text,
String  font,
int  size,
int  align 
)
static

Get the shape corresponding to a text. Use the textFont method to select the font and size. getText

Parameters
fontthe filename of the font to be loaded
textthe string to be created
sizethe size of the font to be used
alignthe alignment. Use RG.CENTER, RG.LEFT or RG.RIGHT
Returns
RShape, the shape created
static RShape geomerative.RG.getText ( String  text)
static
static void geomerative.RG.ignoreStyles ( boolean  value)
static

Ignore the styles of the shapes when drawing and use the Processing style methods. ignoreStyles

Parameters
valuevalue to which the ignoreStyles state should be set
static void geomerative.RG.ignoreStyles ( )
static
static void geomerative.RG.init ( PApplet  _parent)
static

Initialize the library. Must be called before any call to Geomerative methods. Must be called by passing the PApplet. e.g. RG.init(this)

static boolean geomerative.RG.initialized ( )
static
static RFont geomerative.RG.loadFont ( String  fontFile)
static

Load and get the font object that can be used in the textFont method. loadFont

Parameters
fontFilethe filename of the font to be loaded
Returns
RFont, the font object
static RShape geomerative.RG.loadShape ( String  filename)
static

Load a shape object from a file. loadShape

Parameters
filenamethe SVG file to be loaded. Must be in the data directory
static PApplet geomerative.RG.parent ( )
staticprotected
static void geomerative.RG.saveShape ( String  filename,
RShape  shape 
)
static

Save a shape object to a file. saveShape

Parameters
filenamethe SVG file to be saved.
shapethe shape to be saved.
static void geomerative.RG.setAdaptorLengthOffset ( float  adptorLengthOffset) throws RuntimeException
static

Use this to set the adaptor length offset. This specifies where to start adapting the group to the shape. RShape_setAdaptorLengthOffset

Parameters
adptorLengthOffsetthe offset along the curve of the shape. Must be a value between 0 and 1;
static void geomerative.RG.setAdaptorScale ( float  adptorScale)
static

Use this to set the adaptor scaling. This scales the transformation of the adaptor. RShape_setAdaptor

Parameters
adptorScalethe scaling coefficient
static void geomerative.RG.setDpi ( int  _dpi)
static

Use this to set the resolution of the display. This specifies the Dots Per Inch of the display.

Parameters
_dpithe dots per inch of the display
static void geomerative.RG.shape ( RShape  shp,
float  x,
float  y,
float  w,
float  h 
)
static

Draw a shape to a given position on the screen. shape

Parameters
shpthe shape to be drawn
xthe horizontal coordinate
ythe vertical coordinate
wthe width with which we draw the shape
hthe height with which we draw the shape
static void geomerative.RG.shape ( RShape  shp,
float  x,
float  y 
)
static
static void geomerative.RG.shape ( RShape  shp)
static
static RShape [] geomerative.RG.split ( RShape  shp,
float  t 
)
static

Split a shape along the curve length in two parts. split

Parameters
shpthe shape to be splited
tthe proportion (a value from 0 to 1) along the curve where to split
Returns
RShape[], an array of shapes with two elements, one for each side of the split
static void geomerative.RG.text ( String  text)
static

Draw text to the screen using the font set using the textFont method. text

Parameters
textthe string to be drawn on the screen
static void geomerative.RG.textFont ( RFont  font,
int  size 
)
static

Set the font object to be used in all text calls. textFont

Parameters
fontthe font object to be set
sizethe size of the font
static void geomerative.RG.vertex ( float  x,
float  y 
)
static

Add a vertex to the shape. Can only be called inside beginShape() and endShape(). createShape

Parameters
xthe x coordinate of the vertex
ythe y coordinate of the vertex

Friends And Related Function Documentation

static RShape adapt ( RShape  shp,
RShape  path 
)
related

Adapt a shape along the curve of another shape. split

Parameters
shpthe shape to be adapted
paththe shape which curve will be followed
Returns
RShape the adapted shape ( )
static RShape diff ( RShape  a,
RShape  b 
)
related

Binary difference between two shapes. binaryOps

Parameters
afirst shape to operate on
bsecond shape to operate on
Returns
RShape, the result of the operation ( ) ( ) ( ) ( )
static RShape intersection ( RShape  a,
RShape  b 
)
related

Binary intersection between two shapes. binaryOps

Parameters
afirst shape to operate on
bsecond shape to operate on
Returns
RShape, the result of the operation ( ) ( ) ( ) ( )
static RShape polygonize ( RShape  shp)
related

Polygonize a shape. split

Parameters
shpthe shape to be polygonized
Returns
RShape, the polygonized shape ( )
static void setAdaptor ( int  adptorType)
related

Use this to set the adaptor type. RShape_setAdaptor

Parameters
adptorTypeit can be RG.BYPOINT, RG.BYELEMENTPOSITION or RG.BYELEMENTINDEX
static void setPolygonizer ( int  segmenterMethod)
related

Use this to set the polygonizer type.

Parameters
segmenterMethodcan be RG.ADAPTATIVE, RG.UNIFORMLENGTH or RG.UNIFORMSTEP.

setPolygonizer

static void setPolygonizerAngle ( float  angle)
related

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

Parameters
anglean angle from 0 to PI/2 it defines the maximum angle between segments.
static void setPolygonizerLength ( float  length)
related

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

Parameters
lengththe length of each resulting segment.

( )

static void setPolygonizerStep ( float  step)
related

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

Parameters
stepif 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).

( )

static RShape union ( RShape  a,
RShape  b 
)
related

Binary union between two shapes. binaryOps

Parameters
afirst shape to operate on
bsecond shape to operate on
Returns
RShape, the result of the operation ( ) ( ) ( ) ( )
static RShape xor ( RShape  a,
RShape  b 
)
related

Binary xor between two shapes. binaryOps

Parameters
afirst shape to operate on
bsecond shape to operate on
Returns
RShape, the result of the operation ( ) ( ) ( ) ( )

Member Data Documentation

int geomerative.RG.ADAPTATIVE = RCommand.ADAPTATIVE
static

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.

final int geomerative.RG.BYELEMENTINDEX = 2
static

The adaptor adapts the shape to a particular shape by adapting each of the groups elements indices. This mantains the proportions of the shapes.

final int geomerative.RG.BYELEMENTPOSITION = 1
static

The adaptor adapts the shape to a particular shape by adapting each of the groups elements positions. This mantains the proportions of the shapes.

final int geomerative.RG.BYPOINT = 0
static

The adaptor adapts the shape to a particular shape by adapting each of the groups points. This can cause deformations of the individual elements in the group.

boolean geomerative.RG.ignoreStyles = false
static
boolean geomerative.RG.initialized = false
staticprivate
PApplet geomerative.RG.parent
staticprivate
int geomerative.RG.UNIFORMLENGTH = RCommand.UNIFORMLENGTH
static

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.

int geomerative.RG.UNIFORMSTEP = RCommand.UNIFORMSTEP
static

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.

boolean geomerative.RG.useFastClip = true
static

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