net.returnvoid.graphics.grid

## Class GridMaker

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

-     public class GridMaker
      extends java.lang.Object

  A grid factory class to help setting up grids easily.
  Author:
    Diana Lange

- - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static EllipseGrid` | `createEllipse()` Creates an ellipsoid grid.
    `static EllipseGrid` | `createEllipse(float x, float y)` Creates an ellipsoid grid.
    `static EllipseGrid` | `createEllipse(float x, float y, float radius)` Creates an ellipsoid grid.
    `static EllipseGrid` | `createEllipse(float x, float y, float radius, int size)` Creates an ellipsoid grid.
    `static EquiSpiralGrid` | `createEquiSpiral()` Creates a spiral grid.
    `static EquiSpiralGrid` | `createEquiSpiral(float x, float y)` Creates a spiral grid.
    `static EquiSpiralGrid` | `createEquiSpiral(float x, float y, float radius)` Creates a spiral grid.
    `static EquiSpiralGrid` | `createEquiSpiral(float x, float y, float radius, float elementDistance)` Creates a spiral grid.
    `static EquiSpiralGrid` | `createEquiSpiral(float x, float y, float radius, float elementDistance, float rotations)` Creates a spiral grid.
    `static SpiralGrid` | `createSpiral()` Creates a spiral grid.
    `static SpiralGrid` | `createSpiral(float x, float y)` Creates a spiral grid.
    `static SpiralGrid` | `createSpiral(float x, float y, float angle)` Creates a spiral grid.
    `static SpiralGrid` | `createSpiral(float x, float y, float angle, float rotations)` Creates a spiral grid.
    `static SpiralGrid` | `createSpiral(float x, float y, float radius, float angle, float rotations)` Creates a spiral grid.
    `static SpiralGrid` | `createSpiral(float x, float y, int size, float rotations, float endRadius)` Creates a spiral grid.
    `static TableGrid` | `createTable()` Creates a table grid (a grid that is defined by rows and columns).
    `static TableGrid` | `createTable(float x, float y, float w, float h, int size)` Creates a table grid (a grid that is defined by rows and columns).
    `static TableGrid` | `createTable(float x, float y, float w, float h, int columns, int rows)` Creates a table grid (a grid that is defined by rows and columns).
    `static TableGrid` | `createTable(float w, float h, int size)` Creates a table grid (a grid that is defined by rows and columns).
    `static TableGrid` | `createTable(float w, float h, int columns, int rows)` Creates a table grid (a grid that is defined by rows and columns).

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

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

- - ### Method Detail

    - #### createSpiral

          public static SpiralGrid createSpiral()

      Creates a spiral grid. The elements of this grid will be located on a spiral. The elements will be distributed not visually evenly. This means, the elements will be closer to each other in the center of the spiral than the ones at the bounds.
      This method sets up a basic spiral grid at location (0, 0), with a radius of 100 and one rotation. The elements will be separated by PI * 0.1 radian. You can change these settings after the grid has been built. Example:

           SpiralGrid grid = GridMaker.createSpiral().setX(200).setY(100);

      Returns:
        The new spiral grid.

    - #### createSpiral

          public static SpiralGrid createSpiral(float x,
                                                float y)

      Creates a spiral grid. The elements of this grid will be located on a spiral. The elements will be distributed not visually evenly. This means, the elements will be closer to each other in the center of the spiral than the ones at the bounds.
      This method sets up a basic spiral grid at location (x, y), with a radius of 100 and one rotation. The elements will be separated by PI * 0.1 radian. You can change these settings after the grid has been built. Example:

           SpiralGrid grid = GridMaker.createSpiral(200, 100).setRotations(5);

      Parameters:
        `x` - The center-x location of the grid.
        `y` - The center-y location of the grid
      Returns:
        The new spiral grid.

    - #### createSpiral

          public static SpiralGrid createSpiral(float x,
                                                float y,
                                                float angle)

      Creates a spiral grid. The elements of this grid will be located on a spiral. The elements will be distributed not visually evenly. This means, the elements will be closer to each other in the center of the spiral than the ones at the bounds.
      This method sets up a basic spiral grid at location (x, y), with a radius of 100 and one rotation. The elements will be separated by angle radian. You can change these settings after the grid has been built. Example:

           SpiralGrid grid = GridMaker.createSpiral(200, 100, PI / 4).setRotations(5);

      Parameters:
        `x` - The center-x location of the grid.
        `y` - The center-y location of the grid
        `angle` - The angle distance for each element (in radians).
      Returns:
        The new spiral grid.

    - #### createSpiral

          public static SpiralGrid createSpiral(float x,
                                                float y,
                                                float angle,
                                                float rotations)

      Creates a spiral grid. The elements of this grid will be located on a spiral. The elements will be distributed not visually evenly. This means, the elements will be closer to each other in the center of the spiral than the ones at the bounds.
      This method sets up a basic spiral grid at location (x, y), with a radius of 100 and rotations (number of rotations). The elements will be separated by angle radian. You can change these settings after the grid has been built. Example:

           SpiralGrid grid = GridMaker.createSpiral(200, 100, PI / 4, 5).setEndRadius(300);

      Parameters:
        `x` - The center-x location of the grid.
        `y` - The center-y location of the grid
        `angle` - The angle distance for each element (in radians).
        `rotations` - Sets the number of rotations the spiral should make.
      Returns:
        The new spiral grid.

    - #### createSpiral

          public static SpiralGrid createSpiral(float x,
                                                float y,
                                                float radius,
                                                float angle,
                                                float rotations)

      Creates a spiral grid. The elements of this grid will be located on a spiral. The elements will be distributed not visually evenly. This means, the elements will be closer to each other in the center of the spiral than the ones at the bounds.
      This method sets up a basic spiral grid at location (x, y), with a radius of 100 and rotations (number of rotations). The elements will be separated by angle radian. You can change these settings after the grid has been built. Example:

           SpiralGrid grid = GridMaker.createSpiral(200, 100, PI / 4, 5).setEndRadius(300);

      Parameters:
        `x` - The center-x location of the grid.
        `y` - The center-y location of the grid.
        `radius` - The outer radius of the spiral.
        `angle` - The angle distance for each element (in radians).
        `rotations` - Sets the number of rotations the spiral should make.
      Returns:
        The new spiral grid.

    - #### createSpiral

          public static SpiralGrid createSpiral(float x,
                                                float y,
                                                int size,
                                                float rotations,
                                                float endRadius)

      Creates a spiral grid. The elements of this grid will be located on a spiral. The elements will be distributed not visually evenly. This means, the elements will be closer to each other in the center of the spiral than the ones at the bounds.
      This method sets up a basic spiral grid at location (x, y), with a radius of endRadius and rotations (number of rotations). There will be size elements positionen on this grid. You can change these settings after the grid has been built. Example:

           SpiralGrid grid = GridMaker.createSpiral(200, 100, 20, 5, 300);

      Parameters:
        `x` - The center-x location of the grid.
        `y` - The center-y location of the grid
        `size` - Sets the number of elements which will be placed on the grid.
        `rotations` - Sets the number of rotations the spiral should make.
        `endRadius` - Sets the radius where the spiral ends. The last element of this grid will be positioned on that radius.
      Returns:
        The new spiral grid.

    - #### createEllipse

          public static EllipseGrid createEllipse()

      Creates an ellipsoid grid. The elements of this grid will be located on an ellipse with a given radius. The elements will be distributed evenly.
      This method sets up a basic ellipsoid grid at location (0, 0), with a radius of 100 and 20 elements. You can change these settings after the grid has been built. Example:

           EllipseGrid grid = GridMaker.createEllipse().setX(200).setY(100);

      Returns:
        The new ellipsoid grid.

    - #### createEllipse

          public static EllipseGrid createEllipse(float x,
                                                  float y)

      Creates an ellipsoid grid. The elements of this grid will be located on an ellipse with a given radius. The elements will be distributed evenly.
      This method sets up a basic ellipsoid grid at location (x, y), with a radius of 100 and 20 elements. You can change these settings after the grid has been built. Example:

           EllipseGrid grid = GridMaker.createEllipse(200, 100).setRadius(200);

      Parameters:
        `x` - The center-x location of the grid.
        `y` - The center-y location of the grid
      Returns:
        The new ellipsoid grid.

    - #### createEllipse

          public static EllipseGrid createEllipse(float x,
                                                  float y,
                                                  float radius)

      Creates an ellipsoid grid. The elements of this grid will be located on an ellipse with a given radius. The elements will be distributed evenly.
      This method sets up a basic ellipsoid grid at location (x, y), with radius and 20 elements. You can change these settings after the grid has been built. Example:

           EllipseGrid grid = GridMaker.createEllipse(200, 100, 50.5).setSize(50);

      Parameters:
        `x` - The center-x location of the grid.
        `y` - The center-y location of the grid
        `radius` - Sets the radius for this grid. The width and height of the grid will be equal.
      Returns:
        The new ellipsoid grid.

    - #### createEllipse

          public static EllipseGrid createEllipse(float x,
                                                  float y,
                                                  float radius,
                                                  int size)

      Creates an ellipsoid grid. The elements of this grid will be located on an ellipse with a given radius. The elements will be distributed evenly.
      This method sets up a basic ellipsoid grid at location (x, y), with radius and size elements. You can change these settings after the grid has been built. Example:

           EllipseGrid grid = GridMaker.createEllipse(200, 100, 50.5, 50)

      Parameters:
        `x` - The center-x location of the grid.
        `y` - The center-y location of the grid
        `radius` - Sets the radius for this grid. The width and height of the grid will be equal.
        `size` - The number of elements for this grid (>= 1).
      Returns:
        The new ellipsoid grid.

    - #### createTable

          public static TableGrid createTable()

      Creates a table grid (a grid that is defined by rows and columns). The elements will be distributed evenly.
      This method sets up a basic table grid at location (0, 0), with 100 width, 100 height and 100 elements. You can change these settings after the grid has been built. Example:

           TableGrid grid = GridMaker.createTable().setX(200).setY(100);

      Returns:
        The new table grid.

    - #### createTable

          public static TableGrid createTable(float w,
                                              float h,
                                              int size)

      Creates a table grid (a grid that is defined by rows and columns). The elements will be distributed evenly.
      This method sets up a basic table grid at location (0, 0), with w width, h height and approx. size elements. The size is just an approximation because this method tries to create quadratic grid elements rather then rectangles. But depending on the width and height of the grid, there might be no solution which will match the exact given size. You can change these settings after the grid has been built. Example:

           TableGrid grid = GridMaker.createTable(100, 200, 344).setX(200).setY(100);

      Parameters:
        `w` - The width of the grid.
        `h` - The height of the grid.
        `size` - The number of elements for this grid (>= 1).
      Returns:
        The new table grid.

    - #### createTable

          public static TableGrid createTable(float w,
                                              float h,
                                              int columns,
                                              int rows)

      Creates a table grid (a grid that is defined by rows and columns). The elements will be distributed evenly.
      This method sets up a basic table grid at location (0, 0), with w width, h and columns * rows elements. You can change these settings after the grid has been built. Example:

           TableGrid grid = GridMaker.createTable(200.5, 100, 10, 20).setX(200).setY(100);

      Parameters:
        `w` - The width of the grid.
        `h` - The height of the grid.
        `columns` - The number of columns of the grid.
        `rows` - The number of rows of the grid.
      Returns:
        The new table grid.

    - #### createTable

          public static TableGrid createTable(float x,
                                              float y,
                                              float w,
                                              float h,
                                              int size)

      Creates a table grid (a grid that is defined by rows and columns). The elements will be distributed evenly.
      This method sets up a basic table grid at location (x, y), with w width, h height and approx. size elements. The size is just an approximation because this method tries to create quadratic grid elements rather then rectangles. But depending on the width and height of the grid, there might be no solution which will match the exact given size. You can change these settings after the grid has been built. Example:

           TableGrid grid = GridMaker.createTable(200, 200, 100, 100, 344);

      Parameters:
        `x` - The x-location of the grid (top-left corner).
        `y` - The y-location of the grid (top-left corner).
        `w` - The width of the grid.
        `h` - The height of the grid.
        `size` - The number of elements for this grid (>= 1).
      Returns:
        The new table grid.

    - #### createTable

          public static TableGrid createTable(float x,
                                              float y,
                                              float w,
                                              float h,
                                              int columns,
                                              int rows)

      Creates a table grid (a grid that is defined by rows and columns). The elements will be distributed evenly.
      This method sets up a basic table grid at location (x, y), with w width, h and columns * rows elements. You can change these settings after the grid has been built. Example:

           TableGrid grid = GridMaker.createTable(200, 100, 200.5, 100, 10, 20);

      Parameters:
        `x` - The x-location of the grid (top-left corner).
        `y` - The y-location of the grid (top-left corner).
        `w` - The width of the grid.
        `h` - The height of the grid.
        `columns` - The number of columns of the grid.
        `rows` - The number of rows of the grid.
      Returns:
        The new table grid.

    - #### createEquiSpiral

          public static EquiSpiralGrid createEquiSpiral()

      Creates a spiral grid. The elements of this grid will be located on a spiral with a given start and end radius. The elements will be distributed visually evenly (approx.).
      This method sets up a basic spiral grid at location (0, 0), with 100 radius and one rotation. The elements will have a distance of 30 to each other. You can change these settings after the grid has been built. Example:

           EquiSpiralGrid grid = GridMaker.createEquiSpiral().setX(200).setY(200);

      Returns:
        The new spiral grid.

    - #### createEquiSpiral

          public static EquiSpiralGrid createEquiSpiral(float x,
                                                        float y)

      Creates a spiral grid. The elements of this grid will be located on a spiral with a given start and end radius. The elements will be distributed visually evenly (approx.).
      This method sets up a basic spiral grid at location (x, y), with 100 radius and one rotation. The elements will have a distance of 30 to each other. You can change these settings after the grid has been built. Example:

           EquiSpiralGrid grid = GridMaker.createEquiSpiral(200, 200).setElementDistance(60);

      Parameters:
        `x` - The center-x location of the grid.
        `y` - The center-y location of the grid
      Returns:
        The new spiral grid.

    - #### createEquiSpiral

          public static EquiSpiralGrid createEquiSpiral(float x,
                                                        float y,
                                                        float radius)

      Creates a spiral grid. The elements of this grid will be located on a spiral with a given start and end radius. The elements will be distributed visually evenly (approx.).
      This method sets up a basic spiral grid at location (x, y), with radius and one rotation. The elements will have a distance of 30 to each other. You can change these settings after the grid has been built. Example:

           EquiSpiralGrid grid = GridMaker.createEquiSpiral(200, 200, 100).setElementDistance(60);

      Parameters:
        `x` - The center-x location of the grid.
        `y` - The center-y location of the grid
        `radius` - Sets the radius where the spiral ends. The last element of this grid will be positioned on that radius.
      Returns:
        The new spiral grid.

    - #### createEquiSpiral

          public static EquiSpiralGrid createEquiSpiral(float x,
                                                        float y,
                                                        float radius,
                                                        float elementDistance)

      Creates a spiral grid. The elements of this grid will be located on a spiral with a given start and end radius. The elements will be distributed visually evenly (approx.).
      This method sets up a basic spiral grid at location (x, y), with radius and one rotation. The elements will have a distance of elementDistance to each other. You can change these settings after the grid has been built. Example:

           EquiSpiralGrid grid = GridMaker.createEquiSpiral(200, 200, 100, 60).setRotations(5.5);

      Parameters:
        `x` - The center-x location of the grid.
        `y` - The center-y location of the grid
        `radius` - Sets the radius where the spiral ends. The last element of this grid will be positioned on that radius.
        `elementDistance` - The distance of each element to its neighbors (>= 1).
      Returns:
        The new spiral grid.

    - #### createEquiSpiral

          public static EquiSpiralGrid createEquiSpiral(float x,
                                                        float y,
                                                        float radius,
                                                        float elementDistance,
                                                        float rotations)

      Creates a spiral grid. The elements of this grid will be located on a spiral with a given start and end radius. The elements will be distributed visually evenly (approx.).
      This method sets up a basic spiral grid at location (x, y), with radius and rotations (number of rotations). The elements will have a distance of elementDistance to each other. You can change these settings after the grid has been built. Example:

           EquiSpiralGrid grid = GridMaker.createEquiSpiral(200, 200, 100, 60, 5.5);

      Parameters:
        `x` - The center-x location of the grid.
        `y` - The center-y location of the grid
        `radius` - Sets the radius where the spiral ends. The last element of this grid will be positioned on that radius.
        `elementDistance` - The distance of each element to its neighbors (>= 1).
        `rotations` - Sets the number of rotations the spiral should make.
      Returns:
        The new spiral grid.