net.returnvoid.graphics.grid

## Class EllipseGrid

- java.lang.Object
- - net.returnvoid.graphics.grid.EllipseGrid

- All Implemented Interfaces:
    RGrid

      public class EllipseGrid
      extends java.lang.Object
      implements RGrid

  This class helps to build an ellipsoid grid. The elements of this grid will be located on an ellipse with a given radius. The elements will be distributed evenly.
  Author:
    Diana Lange

- - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.lang.Float` | `elementSize()` Calculates and returns the size of any element of the grid.
    `java.lang.Float` | `getAngle(java.lang.Integer index)` Returns the angle of an element with the given index.
    `processing.core.PVector[]` | `getCoordinates()` Returns all positions of all elements in the grid.
    `java.lang.Float` | `getHeight()` Returns the current height of the grid.
    `java.lang.Float` | `getHeight(java.lang.Integer i)` Returns the current height of the grid.
    `java.lang.Float` | `getPadding()` Returns the space between the elements of the grid.
    `java.lang.Float` | `getRadius()` Returns the radius of this grid (use this function, when this grid is a circle and not an ellipse).
    `java.lang.Float` | `getRadiusX()` Returns the horizontal radius of this grid.
    `java.lang.Float` | `getRadiusY()` Returns the vertical radius of this grid.
    `java.lang.Float` | `getStartAngle()` Returns the angle that describes the position of the first element of this grid.
    `java.lang.Float` | `getWidth()` Returns the width of the element at the given index.
    `java.lang.Float` | `getWidth(java.lang.Integer i)` Returns the current width of the grid.
    `java.lang.Float` | `getX()` Returns the current x-position of the grid.
    `java.lang.Float` | `getX(java.lang.Integer index)` Returns the x-position of the element at the given index.
    `java.lang.Float` | `getY()` Returns the current y-position of the grid.
    `java.lang.Float` | `getY(java.lang.Integer index)` Returns the y-position of the element at the given index.
    `EllipseGrid` | `setPadding(float padding)` Sets the padding (space between elements of the grid).
    `EllipseGrid` | `setRadius(float r)` Sets the radius for this grid.
    `EllipseGrid` | `setRadiusX(float r)` Sets the horizontal radius for this grid.
    `EllipseGrid` | `setRadiusY(float r)` Sets the vertical radius for this grid.
    `EllipseGrid` | `setSize(java.lang.Integer size)` Sets the number of elements for this grid.
    `EllipseGrid` | `setStartAngle(float startAngle)` Set the position of the first element of the grid.
    `EllipseGrid` | `setX(float x)` Set to x-position of the grid.
    `EllipseGrid` | `setY(float y)` Set to y-position of the grid.
    `java.lang.Integer` | `size()` Returns the number of elements in the grid.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### setX

          public EllipseGrid setX(float x)

      Description copied from interface: `RGrid`
      Set to x-position of the grid.
      Specified by:
        `setX` in interface `RGrid`
      Parameters:
        `x` - The new x-position of the grid.
      Returns:
        The current grid object.

    - #### setY

          public EllipseGrid setY(float y)

      Description copied from interface: `RGrid`
      Set to y-position of the grid.
      Specified by:
        `setY` in interface `RGrid`
      Parameters:
        `y` - The new y-position of the grid.
      Returns:
        The current grid object.

    - #### setRadius

          public EllipseGrid setRadius(float r)

      Sets the radius for this grid. The width and height of the grid will be equal.
      Parameters:
        `r` - The new radius of this grid.
      Returns:
        The current grid object.

    - #### setRadiusX

          public EllipseGrid setRadiusX(float r)

      Sets the horizontal radius for this grid.
      Parameters:
        `r` - The new horizontal radius of this grid.
      Returns:
        The current grid object.

    - #### setRadiusY

          public EllipseGrid setRadiusY(float r)

      Sets the vertical radius for this grid.
      Parameters:
        `r` - The new vertical radius of this grid.
      Returns:
        The current grid object.

    - #### setSize

          public EllipseGrid setSize(java.lang.Integer size)

      Sets the number of elements for this grid.
      Parameters:
        `size` - The new number of elements for this grid (>= 1).
      Returns:
        The current grid object.

    - #### setStartAngle

          public EllipseGrid setStartAngle(float startAngle)

      Set the position of the first element of the grid.
      Parameters:
        `startAngle` - The angle which describes the position of the first element (in radian).
      Returns:
        The current grid object.

    - #### setPadding

          public EllipseGrid setPadding(float padding)

      Sets the padding (space between elements of the grid).
      Specified by:
        `setPadding` in interface `RGrid`
      Parameters:
        `padding` - The new padding of this grid [0, 1].
      Returns:
        The current grid object.

    - #### getCoordinates

          public processing.core.PVector[] getCoordinates()

      Description copied from interface: `RGrid`
      Returns all positions of all elements in the grid.
      Specified by:
        `getCoordinates` in interface `RGrid`
      Returns:
        The positions.

    - #### getX

          public java.lang.Float getX()

      Description copied from interface: `RGrid`
      Returns the current x-position of the grid.
      Specified by:
        `getX` in interface `RGrid`
      Returns:
        The x-position.

    - #### getWidth

          public java.lang.Float getWidth()

      Description copied from interface: `RGrid`
      Returns the width of the element at the given index.
      Specified by:
        `getWidth` in interface `RGrid`
      Returns:
        The width.

    - #### getHeight

          public java.lang.Float getHeight()

      Description copied from interface: `RGrid`
      Returns the current height of the grid.
      Specified by:
        `getHeight` in interface `RGrid`
      Returns:
        The height.

    - #### getY

          public java.lang.Float getY()

      Description copied from interface: `RGrid`
      Returns the current y-position of the grid.
      Specified by:
        `getY` in interface `RGrid`
      Returns:
        The y-position.

    - #### getStartAngle

          public java.lang.Float getStartAngle()

      Returns the angle that describes the position of the first element of this grid.
      Returns:
        The angle.

    - #### getRadius

          public java.lang.Float getRadius()

      Returns the radius of this grid (use this function, when this grid is a circle and not an ellipse).
      Returns:
        The value of the radius.

    - #### getRadiusX

          public java.lang.Float getRadiusX()

      Returns the horizontal radius of this grid.
      Returns:
        The value of the horizontal radius.

    - #### getRadiusY

          public java.lang.Float getRadiusY()

      Returns the vertical radius of this grid.
      Returns:
        The value of the vertical radius.

    - #### getPadding

          public java.lang.Float getPadding()

      Returns the space between the elements of the grid.
      Specified by:
        `getPadding` in interface `RGrid`
      Returns:
        The padding.

    - #### size

          public java.lang.Integer size()

      Description copied from interface: `RGrid`
      Returns the number of elements in the grid. This is usefull if you want to iterate over all elements of the grid. Example:

           for (int i = 0; i < myGrid.size(); i++) {
                          float x = myGrid.getX(i);
                          float y = myGrid.getY(i):
           }

      Specified by:
        `size` in interface `RGrid`
      Returns:
        The number of elements of the grid.

    - #### getAngle

          public java.lang.Float getAngle(java.lang.Integer index)

      Returns the angle of an element with the given index.
      Parameters:
        `index` - The index of the element [0, size()]
      Returns:
        The angle the element with that index.

    - #### getX

          public java.lang.Float getX(java.lang.Integer index)

      Description copied from interface: `RGrid`
      Returns the x-position of the element at the given index. index should be in the range of this grid [0, myGrid.size()], otherwise the call of this function might produce strange results or will produce an ArrayIndexOutOfBoundsException. Usage:

           for (int i = 0; i < myGrid.size(); i++) {
                          float x = myGrid.getX(i);
                          float y = myGrid.getY(i):
           }

      Specified by:
        `getX` in interface `RGrid`
      Parameters:
        `index` - The index of the element.
      Returns:
        The x-position of the element.

    - #### getY

          public java.lang.Float getY(java.lang.Integer index)

      Description copied from interface: `RGrid`
      Returns the y-position of the element at the given index. index should be in the range of this grid [0, myGrid.size()], otherwise the call of this function might produce strange results or will produce an ArrayIndexOutOfBoundsException. Usage:

           for (int i = 0; i < myGrid.size(); i++) {
                          float x = myGrid.getX(i);
                          float y = myGrid.getY(i):
           }

      Specified by:
        `getY` in interface `RGrid`
      Parameters:
        `index` - The index of the element.
      Returns:
        The y-position of the element.

    - #### elementSize

          public java.lang.Float elementSize()

      Calculates and returns the size of any element of the grid. The size equals to the distance of any element to their neighbors.
      Returns:
        The size of any element of this grid.

    - #### getWidth

          public java.lang.Float getWidth(java.lang.Integer i)

      Description copied from interface: `RGrid`
      Returns the current width of the grid.
      Specified by:
        `getWidth` in interface `RGrid`
      Parameters:
        `i` - The index of the element.
      Returns:
        The width.

    - #### getHeight

          public java.lang.Float getHeight(java.lang.Integer i)

      Description copied from interface: `RGrid`
      Returns the current height of the grid.
      Specified by:
        `getHeight` in interface `RGrid`
      Parameters:
        `i` - The index of the element.
      Returns:
        The height.