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

## geomerative
Class RGeomElem

    java.lang.Object
      geomerative.RGeomElem

Direct Known Subclasses:
  RCommand, RContour, RGroup, RMesh, RPath, RPolygon, RShape

    public abstract class RGeomElem

extends java.lang.Object

RGeomElem is an interface to any Geometric element that can be drawn and transformed, such as Shapes, Polygons or Meshes.

Field Summary
`static int` | `COMMAND`
`static int` | `CONTOUR`
`static int` | `GROUP`
`static int` | `MESH`
`java.lang.String` | `name`
`static int` | `POLYGON`
`static int` | `SHAPE`
`static int` | `SUBSHAPE`
`static int` | `TRISTRIP`
`static int` | `UNKNOWN`

Constructor Summary
`RGeomElem()`

Method Summary
`void` | `centerIn(processing.core.PGraphics g)`
`void` | `centerIn(processing.core.PGraphics g, float margin)`
`void` | `centerIn(processing.core.PGraphics g, float margin, float sclDamping, float trnsDamping)`
`boolean` | `contains(RGeomElem shp)` Use this method to test if the shape contains another shape.
`abstract boolean` | `contains(RPoint p)`
`boolean` | `contains(RPoint[] ps)` Use this method to test if the shape contains an array of points.
`boolean` | `containsBounds(RGeomElem shp)` Use this method to test if the shape contains the bounding box of another shape.
`boolean` | `containsHandles(RGeomElem shp)` Use this method to test if the shape contains the handles of another shape.
`void` | `draw()`
`abstract void` | `draw(processing.core.PApplet g)`
`abstract void` | `draw(processing.core.PGraphics g)`
`float` | `getArea()` Use this method to get the area of an element.
`RPoint` | `getBottomLeft()` Use this method to get the (top left position) of the element.
`RPoint` | `getBottomRight()` Use this method to get the (top left position) of the element.
`geomerative.RRectangle` | `getBounds()` Use this method to get the bounding box of the element.
`RPoint[]` | `getBoundsPoints()` Use this method to get the points of the bounding box of the element.
`RPoint` | `getCenter()` Use this method to get the center point of the element.
`RMatrix` | `getCenteringTransf(processing.core.PGraphics g)`
`RMatrix` | `getCenteringTransf(processing.core.PGraphics g, float margin)`
`RMatrix` | `getCenteringTransf(processing.core.PGraphics g, float margin, float sclDamping, float trnsDamping)` Use this method to get the transformation matrix in order to fit and center the element on the canvas.
`RPoint` | `getCentroid()` Use this method to get the centroid of the element.
`float` | `getCurveLength()` Use this to return the points on the curve.
`float[]` | `getCurveLengths()` Use this to return the points on the curve.
`abstract RPoint[]` | `getHandles()`
`abstract RPoint[][]` | `getHandlesInPaths()`
`float` | `getHeight()` Use this method to get the height of the element.
`float` | `getOrigHeight()` Use this method to get the origianl height of the element.
`float` | `getOrigWidth()` Use this method to get the origianl width of the element.
`abstract RPoint` | `getPoint(float t)`
`abstract RPoint[]` | `getPoints()`
`abstract RPoint[][]` | `getPointsInPaths()`
`abstract RPoint` | `getTangent(float t)`
`abstract RPoint[]` | `getTangents()`
`abstract RPoint[][]` | `getTangentsInPaths()`
`RPoint` | `getTopLeft()` Use this method to get the (top left position) of the element.
`RPoint` | `getTopRight()` Use this method to get the (top left position) of the element.
`abstract int` | `getType()`
`float` | `getWidth()` Use this method to get the width of the element.
`float` | `getX()` Use this method to get the x (left side position) of the element.
`float` | `getY()` Use this method to get the y (left side position) of the element.
`boolean` | `intersects(RGeomElem shp)` Use this method to test if the shape intersects another shape.
`boolean` | `intersects(RPoint[] ps)` Use this method to test if the shape intersects an array of points.
`boolean` | `intersectsBounds(RGeomElem shp)` Use this method to test if the shape intersects the bounding box of another shape.
`boolean` | `intersectsHandles(RGeomElem shp)` Use this method to test if the shape intersects the handles of another shape.
`boolean` | `isIn(processing.core.PApplet g)`
`boolean` | `isIn(processing.core.PGraphics g)` Use this method to know if the shape is inside a graphics object.
`void` | `print()`
`void` | `rotate(float angle)`
`void` | `rotate(float angle, float vx, float vy)` Apply a rotation to the element, given an angle and optionally a rotation center.
`void` | `rotate(float angle, RPoint v)` Apply a rotation to the element, given an angle and optionally a rotation center.
`void` | `scale(float s)`
`void` | `scale(float sx, float sy)`
`void` | `scale(float s, float x, float y)` Apply a scale to the element, given scaling factors and optionally a scaling center.
`void` | `scale(float sx, float sy, float x, float y)` Apply a scale to the element, given scaling factors and optionally a scaling center.
`void` | `scale(float sx, float sy, RPoint p)` Apply a scale to the element, given scaling factors and optionally a scaling center.
`void` | `scale(float s, RPoint p)` Apply a scale to the element, given scaling factors and optionally a scaling center.
`void` | `setAlpha(float opacity)`
`void` | `setAlpha(int opacity)`
`void` | `setAlpha(java.lang.String str)`
`void` | `setFill(boolean _fill)`
`void` | `setFill(int _fillColor)`
`void` | `setFill(java.lang.String str)`
`void` | `setFillAlpha(int opacity)`
`void` | `setFillAlpha(java.lang.String str)`
`void` | `setName(java.lang.String str)`
`void` | `setStroke(boolean _stroke)`
`void` | `setStroke(int _strokeColor)`
`void` | `setStroke(java.lang.String str)`
`void` | `setStrokeAlpha(int opacity)`
`void` | `setStrokeAlpha(java.lang.String str)`
`void` | `setStrokeCap(java.lang.String str)`
`void` | `setStrokeJoin(java.lang.String str)`
`void` | `setStrokeWeight(float value)`
`void` | `setStrokeWeight(java.lang.String str)`
`void` | `setStyle(RStyle s)`
`RMesh` | `toMesh()`
`RPolygon` | `toPolygon()`
`abstract RShape` | `toShape()`
`void` | `transform(float x, float y, float w, float h)`
`void` | `transform(float x, float y, float w, float h, boolean keepAspectRatio)` Transform the geometric object to fit in a rectangle defined by the parameters passed.
`void` | `transform(RMatrix m)`
`void` | `translate(float tx, float ty)` Apply a translation to the element, given translation coordinates.
`void` | `translate(RPoint t)` Apply a translation to the element, given a point.

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

Field Detail

### SHAPE

    public static final int SHAPE

See Also:
  Constant Field Values

### SUBSHAPE

    public static final int SUBSHAPE

See Also:
  Constant Field Values

### COMMAND

    public static final int COMMAND

See Also:
  Constant Field Values

### POLYGON

    public static final int POLYGON

See Also:
  Constant Field Values

### CONTOUR

    public static final int CONTOUR

See Also:
  Constant Field Values

### MESH

    public static final int MESH

See Also:
  Constant Field Values

### TRISTRIP

    public static final int TRISTRIP

See Also:
  Constant Field Values

### GROUP

    public static final int GROUP

See Also:
  Constant Field Values

### UNKNOWN

    public static final int UNKNOWN

See Also:
  Constant Field Values

### name

    public java.lang.String name

Constructor Detail

### RGeomElem

    public RGeomElem()

Method Detail

### draw

    public abstract void draw(processing.core.PGraphics g)

### draw

    public abstract void draw(processing.core.PApplet g)

### draw

    public void draw()

### getPoint

    public abstract RPoint getPoint(float t)

### getTangent

    public abstract RPoint getTangent(float t)

### getHandles

    public abstract RPoint[] getHandles()

### getPoints

    public abstract RPoint[] getPoints()

### getTangents

    public abstract RPoint[] getTangents()

### getHandlesInPaths

    public abstract RPoint[][] getHandlesInPaths()

### getPointsInPaths

    public abstract RPoint[][] getPointsInPaths()

### getTangentsInPaths

    public abstract RPoint[][] getTangentsInPaths()

### contains

    public abstract boolean contains(RPoint p)

### contains

    public boolean contains(RGeomElem shp)

  Use this method to test if the shape contains another shape.

  Returns:
    boolean, true if the shape contains all the points of the other shape

### containsBounds

    public boolean containsBounds(RGeomElem shp)

  Use this method to test if the shape contains the bounding box of another shape.

  Returns:
    boolean, true if the shape contains the bounding box of the other shape

### containsHandles

    public boolean containsHandles(RGeomElem shp)

  Use this method to test if the shape contains the handles of another shape. This method is faster than contains(), but the results might not perfect.

  Returns:
    boolean, true if the shape contains all the handles of the other shape

### contains

    public boolean contains(RPoint[] ps)

  Use this method to test if the shape contains an array of points.

  Returns:
    boolean, true if the shape contains all the points

### intersects

    public boolean intersects(RGeomElem shp)

  Use this method to test if the shape intersects another shape.

  Returns:
    boolean, true if the shape intersects all the points of the other shape

### intersectsBounds

    public boolean intersectsBounds(RGeomElem shp)

  Use this method to test if the shape intersects the bounding box of another shape.

  Returns:
    boolean, true if the shape intersects the bounding box of the other shape

### intersectsHandles

    public boolean intersectsHandles(RGeomElem shp)

  Use this method to test if the shape intersects the handles of another shape. This method is faster than intersects(), but the results might not perfect.

  Returns:
    boolean, true if the shape intersects all the handles of the other shape

### intersects

    public boolean intersects(RPoint[] ps)

  Use this method to test if the shape intersects an array of points.

  Returns:
    boolean, true if the shape intersects all the points

### getType

    public abstract int getType()

### toShape

    public abstract RShape toShape()

### print

    public void print()

### setFill

    public void setFill(boolean _fill)

### setFill

    public void setFill(int _fillColor)

### setFill

    public void setFill(java.lang.String str)

### setStroke

    public void setStroke(boolean _stroke)

### setStroke

    public void setStroke(int _strokeColor)

### setStroke

    public void setStroke(java.lang.String str)

### setStrokeWeight

    public void setStrokeWeight(float value)

### setStrokeWeight

    public void setStrokeWeight(java.lang.String str)

### setStrokeCap

    public void setStrokeCap(java.lang.String str)

### setStrokeJoin

    public void setStrokeJoin(java.lang.String str)

### setStrokeAlpha

    public void setStrokeAlpha(int opacity)

### setStrokeAlpha

    public void setStrokeAlpha(java.lang.String str)

### setFillAlpha

    public void setFillAlpha(int opacity)

### setFillAlpha

    public void setFillAlpha(java.lang.String str)

### setAlpha

    public void setAlpha(float opacity)

### setAlpha

    public void setAlpha(int opacity)

### setAlpha

    public void setAlpha(java.lang.String str)

### setStyle

    public void setStyle(RStyle s)

### setName

    public void setName(java.lang.String str)

### getCurveLengths

    public float[] getCurveLengths()

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

  Returns:
    float[], the arclengths of each command of the path.

### getCurveLength

    public float getCurveLength()

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

  Returns:
    float, the arclength of the path.

### toPolygon

    public RPolygon toPolygon()

### toMesh

    public RMesh toMesh()

### transform

    public void transform(RMatrix m)

### transform

    public void transform(float x,
                          float y,
                          float w,
                          float h,
                          boolean keepAspectRatio)

  Transform the geometric object to fit in a rectangle defined by the parameters passed.

### transform

    public void transform(float x,
                          float y,
                          float w,
                          float h)

### getBounds

    public geomerative.RRectangle getBounds()

  Use this method to get the bounding box of the element.

  Returns:
    RRectangle, the bounding box of the element in the form of a fourpoint contour

### getBoundsPoints

    public RPoint[] getBoundsPoints()

  Use this method to get the points of the bounding box of the element.

  Returns:
    RRectangle, the bounding box of the element in the form of a fourpoint contour

### getTopLeft

    public RPoint getTopLeft()

  Use this method to get the (top left position) of the element.

  Returns:
    float, the x coordinate of the element

### getTopRight

    public RPoint getTopRight()

  Use this method to get the (top left position) of the element.

  Returns:
    float, the x coordinate of the element

### getBottomLeft

    public RPoint getBottomLeft()

  Use this method to get the (top left position) of the element.

  Returns:
    float, the x coordinate of the element

### getBottomRight

    public RPoint getBottomRight()

  Use this method to get the (top left position) of the element.

  Returns:
    float, the x coordinate of the element

### getX

    public float getX()

  Use this method to get the x (left side position) of the element.

  Returns:
    float, the x coordinate of the element

### getY

    public float getY()

  Use this method to get the y (left side position) of the element.

  Returns:
    float, the y coordinate of the element

### getOrigHeight

    public float getOrigHeight()

  Use this method to get the origianl height of the element.

  Returns:
    float, the original height of the element before applying any transformations

### getOrigWidth

    public float getOrigWidth()

  Use this method to get the origianl width of the element.

  Returns:
    float, the original width of the element before applying any transformations

### getWidth

    public float getWidth()

  Use this method to get the width of the element.

  Returns:
    float, the width of the element

### getHeight

    public float getHeight()

  Use this method to get the height of the element.

  Returns:
    float, the height of the element

### getCenter

    public RPoint getCenter()

  Use this method to get the center point of the element.

  Returns:
    RPoint, the center point of the element

### getCentroid

    public RPoint getCentroid()

  Use this method to get the centroid of the element.

  Returns:
    RPoint, the centroid point of the element

### getArea

    public float getArea()

  Use this method to get the area of an element.

  Returns:
    float, the area point of the element

### isIn

    public boolean isIn(processing.core.PGraphics g)

  Use this method to know if the shape is inside a graphics object. This might be useful if we want to delete objects that go offscreen.

  Parameters:
    `g` - the graphics object
  Returns:
    boolean, whether the shape is in or not the graphics object

### isIn

    public boolean isIn(processing.core.PApplet g)

### getCenteringTransf

    public RMatrix getCenteringTransf(processing.core.PGraphics g,
                                      float margin,
                                      float sclDamping,
                                      float trnsDamping)
                               throws java.lang.RuntimeException

  Use this method to get the transformation matrix in order to fit and center the element on the canvas. Scaling and translation damping parameters are available, in order to create animations.

  Parameters:
    `g` - the canvas to which to fit and center the path
    `margin` - the margin to take into account when fitting
    `sclDamping` - a value from 0 to 1. The damping coefficient for the scale, if the value is 0, then no scaling is applied.
    `trnsDamping` - a value from 0 to 1. The damping coefficient for the translation, if the value is 0, then no translation is applied.
  Returns:
    RMatrix, the transformation matrix
  Throws:
    `java.lang.RuntimeException`

### getCenteringTransf

    public RMatrix getCenteringTransf(processing.core.PGraphics g)
                               throws java.lang.RuntimeException

  Throws:
    `java.lang.RuntimeException`

### getCenteringTransf

    public RMatrix getCenteringTransf(processing.core.PGraphics g,
                                      float margin)
                               throws java.lang.RuntimeException

  Throws:
    `java.lang.RuntimeException`

### centerIn

    public void centerIn(processing.core.PGraphics g)

### centerIn

    public void centerIn(processing.core.PGraphics g,
                         float margin)

### centerIn

    public void centerIn(processing.core.PGraphics g,
                         float margin,
                         float sclDamping,
                         float trnsDamping)
                  throws java.lang.RuntimeException

  Throws:
    `java.lang.RuntimeException`

### translate

    public void translate(float tx,
                          float ty)

  Apply a translation to the element, given translation coordinates.

  Parameters:
    `tx` - the coefficient of x translation
    `ty` - the coefficient of y translation

### translate

    public void translate(RPoint t)

  Apply a translation to the element, given a point.

  Parameters:
    `t` - the translation vector to be applied

### rotate

    public void rotate(float angle,
                       float vx,
                       float vy)

  Apply a rotation to the element, given an angle and optionally a rotation center.

  Parameters:
    `angle` - the angle of rotation to be applied
    `vx` - the x coordinate of the center of rotation
    `vy` - the y coordinate of the center of rotation

### rotate

    public void rotate(float angle)

### rotate

    public void rotate(float angle,
                       RPoint v)

  Apply a rotation to the element, given an angle and optionally a rotation center.

  Parameters:
    `angle` - the angle of rotation to be applied
    `v` - the position vector of the center of rotation

### scale

    public void scale(float sx,
                      float sy,
                      RPoint p)

  Apply a scale to the element, given scaling factors and optionally a scaling center.

  Parameters:
    `sx` - the scaling coefficient over the x axis
    `sy` - the scaling coefficient over the y axis
    `p` - the position vector of the center of the scaling

### scale

    public void scale(float sx,
                      float sy)

### scale

    public void scale(float sx,
                      float sy,
                      float x,
                      float y)

  Apply a scale to the element, given scaling factors and optionally a scaling center.

  Parameters:
    `sx` - the scaling coefficient over the x axis
    `sy` - the scaling coefficient over the y axis
    `x` - x coordinate of the position vector of the center of the scaling
    `y` - y coordinate of the position vector of the center of the scaling

### scale

    public void scale(float s,
                      RPoint p)

  Apply a scale to the element, given scaling factors and optionally a scaling center.

  Parameters:
    `s` - the scaling coefficient for a uniform scaling
    `p` - the position vector of the center of the scaling

### scale

    public void scale(float s)

### scale

    public void scale(float s,
                      float x,
                      float y)

  Apply a scale to the element, given scaling factors and optionally a scaling center.

  Parameters:
    `s` - the scaling coefficient for a uniform scaling
    `x` - x coordinate of the position vector of the center of the scaling
    `y` - y coordinate of the position vector of the center of the scaling

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/