Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## geomerative
Class RG

    java.lang.Object
      geomerative.RG

All Implemented Interfaces:
  processing.core.PConstants

    public class RG

extends java.lang.Object
implements processing.core.PConstants

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

Nested Class Summary
`static class` | `RG.FontNotLoadedException`
`static class` | `RG.LibraryNotInitializedException`
`static class` | `RG.NoPathInitializedException`

Field Summary
`static int` | `ADAPTATIVE` ADAPTATIVE segmentator minimizes the number of segments avoiding perceptual artifacts like angles or cusps.
`static int` | `BYELEMENTINDEX` The adaptor adapts the shape to a particular shape by adapting each of the groups elements indices.
`static int` | `BYELEMENTPOSITION` The adaptor adapts the shape to a particular shape by adapting each of the groups elements positions.
`static int` | `BYPOINT` The adaptor adapts the shape to a particular shape by adapting each of the groups points.
`static boolean` | `ignoreStyles`
`static int` | `UNIFORMLENGTH` UNIFORMLENGTH segmentator is the slowest segmentator and it segments the curve on segments of equal length.
`static int` | `UNIFORMSTEP` 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.
`static boolean` | `useFastClip`

Fields inherited from interface processing.core.PConstants
`A, AB, ADD, AG, ALPHA, ALPHA_MASK, ALT, AMBIENT, AR, ARC, ARGB, ARROW, B, BACKSPACE, BASELINE, BEEN_LIT, BEVEL, BLEND, BLUE_MASK, BLUR, BOTTOM, BOX, BURN, CENTER, CENTER_DIAMETER, CENTER_RADIUS, CHATTER, CLOSE, CMYK, CODED, COMPLAINT, CONTROL, CORNER, CORNERS, CROSS, CUSTOM, DA, DARKEST, DB, DEG_TO_RAD, DELETE, DG, DIAMETER, DIFFERENCE, DILATE, DIRECTIONAL, DISABLE_ACCURATE_TEXTURES, DISABLE_DEPTH_SORT, DISABLE_DEPTH_TEST, DISABLE_OPENGL_2X_SMOOTH, DISABLE_OPENGL_ERROR_REPORT, DODGE, DOWN, DR, DXF, EB, EDGE, EG, ELLIPSE, ENABLE_ACCURATE_TEXTURES, ENABLE_DEPTH_SORT, ENABLE_DEPTH_TEST, ENABLE_NATIVE_FONTS, ENABLE_OPENGL_2X_SMOOTH, ENABLE_OPENGL_4X_SMOOTH, ENABLE_OPENGL_ERROR_REPORT, ENTER, EPSILON, ER, ERODE, ERROR_BACKGROUND_IMAGE_FORMAT, ERROR_BACKGROUND_IMAGE_SIZE, ERROR_PUSHMATRIX_OVERFLOW, ERROR_PUSHMATRIX_UNDERFLOW, ERROR_TEXTFONT_NULL_PFONT, ESC, EXCLUSION, G, GIF, GRAY, GREEN_MASK, HALF_PI, HAND, HARD_LIGHT, HINT_COUNT, HSB, IMAGE, INVERT, JAVA2D, JPEG, LEFT, LIGHTEST, LINE, LINES, LINUX, MACOSX, MAX_FLOAT, MAX_INT, MIN_FLOAT, MIN_INT, MITER, MODEL, MOVE, MULTIPLY, NORMAL, NORMALIZED, NX, NY, NZ, OPAQUE, OPEN, OPENGL, ORTHOGRAPHIC, OTHER, OVERLAY, P2D, P3D, PATH, PDF, PERSPECTIVE, PI, platformNames, POINT, POINTS, POLYGON, POSTERIZE, PROBLEM, PROJECT, QUAD, QUAD_STRIP, QUADS, QUARTER_PI, R, RAD_TO_DEG, RADIUS, RECT, RED_MASK, REPLACE, RETURN, RGB, RIGHT, ROUND, SA, SB, SCREEN, SG, SHAPE, SHIFT, SHINE, SOFT_LIGHT, SPB, SPG, SPHERE, SPOT, SPR, SQUARE, SR, SUBTRACT, SW, TAB, TARGA, TEXT, THIRD_PI, THRESHOLD, TIFF, TOP, TRIANGLE, TRIANGLE_FAN, TRIANGLE_STRIP, TRIANGLES, TWO_PI, TX, TY, TZ, U, UP, V, VERTEX_FIELD_COUNT, VW, VX, VY, VZ, WAIT, WHITESPACE, WINDOWS, X, Y, Z`

Constructor Summary
`RG()`

Method Summary
`static RShape` | `adapt(RShape shp, RShape path)` Adapt a shape along the curve of another shape.
`static void` | `beginShape()` Begin to create a shape.
`static void` | `bezierVertex(float cx1, float cy1, float cx2, float cy2, float x, float y)` Add a bezierVertex to the shape.
`static void` | `breakShape()`
`static void` | `breakShape(int endMode)` Begin a new path in the current shape.
`static RShape` | `centerIn(RShape grp, processing.core.PGraphics g)`
`static RShape` | `centerIn(RShape grp, processing.core.PGraphics g, float margin)`
`static RShape` | `createShape(RPoint[][] points)` Create a shape from an array of point arrays.
`static RShape` | `diff(RShape a, RShape b)` Binary difference between two shapes.
`static void` | `endShape()`
`static void` | `endShape(processing.core.PGraphics g)` End the shape being created and draw it to the screen or the PGraphics passed as parameter.
`static RShape` | `getEllipse(float x, float y, float w)`
`static RShape` | `getEllipse(float x, float y, float w, float h)` Get an ellipse as a shape object.
`static RShape` | `getRect(float x, float y, float w)`
`static RShape` | `getRect(float x, float y, float w, float h)` Get an rectangle as a shape object.
`static RShape` | `getRing(float x, float y, float widthBig, float widthSmall)` Get a ring as a shape object.
`static RShape` | `getShape()` End the shape being created and get it as an object.
`static RShape` | `getStar(float x, float y, float widthBig, float widthSmall, int spikes)` Get a star as a shape object.
`static RShape` | `getText(java.lang.String text)`
`static RShape` | `getText(java.lang.String text, java.lang.String font, int size, int align)` Get the shape corresponding to a text.
`static void` | `ignoreStyles()`
`static void` | `ignoreStyles(boolean value)` Ignore the styles of the shapes when drawing and use the processing style methods.
`static void` | `init(processing.core.PApplet _parent)` Initialize the library.
`static boolean` | `initialized()`
`static RShape` | `intersection(RShape a, RShape b)` Binary intersection between two shapes.
`static RFont` | `loadFont(java.lang.String fontFile)` Load and get the font object that can be used in the textFont method.
`static RShape` | `loadShape(java.lang.String filename)` Load a shape object from a file.
`static RShape` | `polygonize(RShape shp)` Polygonize a shape.
`static void` | `setAdaptor(int adptorType)` Use this to set the adaptor type.
`static void` | `setAdaptorLengthOffset(float adptorLengthOffset)` Use this to set the adaptor length offset.
`static void` | `setAdaptorScale(float adptorScale)` Use this to set the adaptor scaling.
`static void` | `setPolygonizer(int segmenterMethod)` Use this to set the polygonizer type.
`static void` | `setPolygonizerAngle(float angle)` Use this to set the segmentator angle tolerance for the ADAPTATIVE segmentator and set the segmentator to ADAPTATIVE.
`static void` | `setPolygonizerLength(float length)` Use this to set the segmentator length for the UNIFORMLENGTH segmentator and set the segmentator to UNIFORMLENGTH.
`static void` | `setPolygonizerStep(float step)` Use this to set the segmentator step for the UNIFORMSTEP segmentator and set the segmentator to UNIFORMSTEP.
`static void` | `shape(RShape shp)`
`static void` | `shape(RShape shp, float x, float y)`
`static void` | `shape(RShape shp, float x, float y, float w, float h)` Draw a shape to a given position on the screen.
`static RShape[]` | `split(RShape shp, float t)` Split a shape along the curve length in two parts.
`static void` | `text(java.lang.String text)` Draw text to the screen using the font set using the textFont method.
`static void` | `textFont(RFont font, int size)` Set the font object to be used in all text calls.
`static RShape` | `union(RShape a, RShape b)` Binary union between two shapes.
`static void` | `vertex(float x, float y)` Add a vertex to the shape.
`static RShape` | `xor(RShape a, RShape b)` Binary xor between two shapes.

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### ignoreStyles

    public static boolean ignoreStyles

### useFastClip

    public static boolean useFastClip

### BYPOINT

    public static final int BYPOINT

  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.

  See Also:
    Constant Field Values

### BYELEMENTPOSITION

    public static final int BYELEMENTPOSITION

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

  See Also:
    Constant Field Values

### BYELEMENTINDEX

    public static final int BYELEMENTINDEX

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

  See Also:
    Constant Field Values

### ADAPTATIVE

    public static int ADAPTATIVE

  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.

### UNIFORMLENGTH

    public static int UNIFORMLENGTH

  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

    public static int UNIFORMSTEP

  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.

Constructor Detail

### RG

    public RG()

Method Detail

### loadFont

    public static RFont loadFont(java.lang.String fontFile)

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

  Parameters:
    `fontFile` - the filename of the font to be loaded
  Returns:
    RFont, the font object

### text

    public static void text(java.lang.String text)

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

  Parameters:
    `text` - the string to be drawn on the screen

### textFont

    public static void textFont(RFont font,
                                int size)

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

  Parameters:
    `font` - the font object to be set
    `size` - the size of the font

### getText

    public static RShape getText(java.lang.String text,
                                 java.lang.String font,
                                 int size,
                                 int align)

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

  Parameters:
    `font` - the filename of the font to be loaded
    `text` - the string to be created
    `size` - the size of the font to be used
    `align` - the alignment. Use RG.CENTER, RG.LEFT or RG.RIGHT
  Returns:
    RShape, the shape created

### getText

    public static RShape getText(java.lang.String text)

### shape

    public static void shape(RShape shp,
                             float x,
                             float y,
                             float w,
                             float h)

  Draw a shape to a given position on the screen.

  Parameters:
    `shp` - the shape to be drawn
    `x` - the horizontal coordinate
    `y` - the vertical coordinate
    `w` - the width with which we draw the shape
    `h` - the height with which we draw the shape

### shape

    public static void shape(RShape shp,
                             float x,
                             float y)

### shape

    public static void shape(RShape shp)

### createShape

    public static RShape createShape(RPoint[][] points)

  Create a shape from an array of point arrays.

### loadShape

    public static RShape loadShape(java.lang.String filename)

  Load a shape object from a file.

  Parameters:
    `filename` - the SVG file to be loaded. Must be in the data directory

### beginShape

    public static void beginShape()

  Begin to create a shape.

### breakShape

    public static void breakShape(int endMode)

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

  Parameters:
    `endMode` - if called with RG.CLOSE it closes the current path before starting the new one.

### breakShape

    public static void breakShape()

### vertex

    public static void vertex(float x,
                              float y)

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

  Parameters:
    `x` - the x coordinate of the vertex
    `y` - the y coordinate of the vertex

### bezierVertex

    public static void bezierVertex(float cx1,
                                    float cy1,
                                    float cx2,
                                    float cy2,
                                    float x,
                                    float y)

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

  Parameters:
    `cx1` - the x coordinate of the first control point
    `cy1` - the y coordinate of the first control point
    `cx2` - the x coordinate of the second control point
    `cy2` - the y coordinate of the second control point
    `x` - the x coordinate of the end point
    `y` - the y coordinate of the end point

### endShape

    public static void endShape(processing.core.PGraphics g)

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

  Parameters:
    `g` - the canvas on which to draw. By default it draws on the screen

### endShape

    public static void endShape()

### getShape

    public static RShape getShape()

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

### getEllipse

    public static RShape getEllipse(float x,
                                    float y,
                                    float w,
                                    float h)

  Get an ellipse as a shape object.

  Parameters:
    `x` - x coordinate of the center of the shape
    `y` - y coordinate of the center of the shape
    `w` - width of the ellipse
    `h` - height of the ellipse
  Returns:
    RShape, the shape created

### getEllipse

    public static RShape getEllipse(float x,
                                    float y,
                                    float w)

### getRect

    public static RShape getRect(float x,
                                 float y,
                                 float w,
                                 float h)

  Get an rectangle as a shape object.

  Parameters:
    `x` - x coordinate of the top left corner of the shape
    `y` - y coordinate of the top left of the shape
    `w` - width of the rectangle
    `h` - height of the rectangle
  Returns:
    RShape, the shape created

### getRect

    public static RShape getRect(float x,
                                 float y,
                                 float w)

### getStar

    public static RShape getStar(float x,
                                 float y,
                                 float widthBig,
                                 float widthSmall,
                                 int spikes)

  Get a star as a shape object.

  Parameters:
    `x` - x coordinate of the center of the shape
    `y` - y coordinate of the center of the shape
    `widthBig` - the outter width of the star polygon
    `widthSmall` - the inner width of the star polygon
    `spikes` - the amount of spikes on the star polygon
  Returns:
    RShape, the shape created

### getRing

    public static RShape getRing(float x,
                                 float y,
                                 float widthBig,
                                 float widthSmall)

  Get a ring as a shape object.

  Parameters:
    `x` - x coordinate of the center of the shape
    `y` - y coordinate of the center of the shape
    `widthBig` - the outter width of the ring polygon
    `widthSmall` - the inner width of the ring polygon
  Returns:
    RShape, the shape created

### centerIn

    public static RShape centerIn(RShape grp,
                                  processing.core.PGraphics g,
                                  float margin)

### centerIn

    public static RShape centerIn(RShape grp,
                                  processing.core.PGraphics g)

### split

    public static RShape[] split(RShape shp,
                                 float t)

  Split a shape along the curve length in two parts.

  Parameters:
    `shp` - the shape to be splited
    `t` - the 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

### adapt

    public static RShape adapt(RShape shp,
                               RShape path)

  Adapt a shape along the curve of another shape.

  Parameters:
    `shp` - the shape to be adapted
    `path` - the shape which curve will be followed
  Returns:
    RShape the adapted shape

### polygonize

    public static RShape polygonize(RShape shp)

  Polygonize a shape.

  Parameters:
    `shp` - the shape to be polygonized
  Returns:
    RShape, the polygonized shape

### init

    public static void init(processing.core.PApplet _parent)

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

### initialized

    public static boolean initialized()

### diff

    public static RShape diff(RShape a,
                              RShape b)

  Binary difference between two shapes.

  Parameters:
    `a` - first shape to operate on
    `b` - second shape to operate on
  Returns:
    RShape, the result of the operation

### union

    public static RShape union(RShape a,
                               RShape b)

  Binary union between two shapes.

  Parameters:
    `a` - first shape to operate on
    `b` - second shape to operate on
  Returns:
    RShape, the result of the operation

### intersection

    public static RShape intersection(RShape a,
                                      RShape b)

  Binary intersection between two shapes.

  Parameters:
    `a` - first shape to operate on
    `b` - second shape to operate on
  Returns:
    RShape, the result of the operation

### xor

    public static RShape xor(RShape a,
                             RShape b)

  Binary xor between two shapes.

  Parameters:
    `a` - first shape to operate on
    `b` - second shape to operate on
  Returns:
    RShape, the result of the operation

### ignoreStyles

    public static void ignoreStyles(boolean value)

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

  Parameters:
    `value` - value to which the ignoreStyles state should be set

### ignoreStyles

    public static void ignoreStyles()

### setAdaptor

    public static void setAdaptor(int adptorType)

  Use this to set the adaptor type.

  Parameters:
    `adptorType` - it can be RG.BYPOINT, RG.BYELEMENTPOSITION or RG.BYELEMENTINDEX

### setAdaptorScale

    public static void setAdaptorScale(float adptorScale)

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

  Parameters:
    `adptorScale` - the scaling coefficient

### setAdaptorLengthOffset

    public static void setAdaptorLengthOffset(float adptorLengthOffset)
                                       throws java.lang.RuntimeException

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

  Parameters:
    `adptorLengthOffset` - the offset along the curve of the shape. Must be a value between 0 and 1;
  Throws:
    `java.lang.RuntimeException`

### setPolygonizer

    public static void setPolygonizer(int segmenterMethod)

  Use this to set the polygonizer type.

  Parameters:
    `segmenterMethod` - can be RG.ADAPTATIVE, RG.UNIFORMLENGTH or RG.UNIFORMSTEP.

### setPolygonizerAngle

    public static void setPolygonizerAngle(float angle)

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

  Parameters:
    `angle` - an angle from 0 to PI/2 it defines the maximum angle between segments.

### setPolygonizerLength

    public static void setPolygonizerLength(float length)

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

  Parameters:
    `length` - the length of each resulting segment.

### setPolygonizerStep

    public static void setPolygonizerStep(float step)

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

  Parameters:
    `step` - if 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).

Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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