net.returnvoid.graphics.shape

## Interface RShape

- All Known Implementing Classes:
    Curve, CurvedLens, Ellipse, Line, LineSegments, Rect

      public interface RShape

  An interface for building two-dimensional shapes.
  Author:
    Diana Lange

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `RShape` | `copy()` Builds and returns a true copy of this shape.
    `RShape` | `draw()` Draws the shape-
    `processing.core.PVector` | `get(int i)` Returns the coordinate with index i.
    `Rect` | `getBoundingBox()` Returns the bounding box of this shape (will mark the bounds of the shape).
    `processing.core.PVector` | `getCenter()` Returns the center coordinate of this shape.
    `processing.core.PVector[]` | `getCoordinates()` Returns all coordinates that defines this shape.
    `java.lang.Float` | `getRotation()` Returns the angle of shape.
    `processing.core.PVector` | `getStart()` Returns the start coordinate for this shape.
    `java.lang.Float` | `getX()` Returns the x-position of the start coordinate for this shape.
    `java.lang.Float` | `getY()` Returns the y-position of the start coordinate for this shape.
    `RShape` | `rotate(float a)` Turns the shape through the given angle.
    `RShape` | `rotate(processing.core.PVector c, float a)` Turns the shape through the given angle.
    `RShape` | `scale(float s)` Scale the shape by the given scaling factor.
    `RShape` | `scale(processing.core.PVector p, float s)` Scale the shape by the given scaling factor.
    `RShape` | `setLocation(float x, float y)` Translates the shape to the given location.
    `RShape` | `setRotation(float a)` Rotates the shape to the given angle (past rotations will be overridden).
    `RShape` | `setRotation(processing.core.PVector c, float a)` Rotates the shape to the given angle (past rotations will be overridden).
    `RShape` | `setX(float x)` Translates the shape to the given x-location.
    `RShape` | `setY(float y)` Translates the shape to the given y-location.
    `int` | `size()` Returns the number of coordinates for this shape.
    `RShape` | `translate(float x, float y)` Translates the coordinates by the given parameters x, y ( "moves the shape by x, y").

- - ### Method Detail

    - #### size

          int size()

      Returns the number of coordinates for this shape. Can be used to iterate over all coordinates for this shape (e.g. for drawing the shape). Example:

           for (int i = 0; i < myShape.size(); i++) {
                  PVector p = myShape.get(i);
           }

      Returns:
        The number of coordinates for this shape.

    - #### get

          processing.core.PVector get(int i)

      Returns the coordinate with index i. Please make sure i is within bounds, e.g. using the size() method. Example:

           for (int i = 0; i < myShape.size(); i++) {
                  PVector p = myShape.get(i);
           }

      Parameters:
        `i` - The index of a coordinates of this shape.
      Returns:
        The coordinate of the shape with the given index.

    - #### getStart

          processing.core.PVector getStart()

      Returns the start coordinate for this shape. The start is defined differently for each shape. For a Line it is one of the ends, for a Rect it is the top left corner (when no rotation is applied) and so on.
      Returns:
        The start coordinate for the shape.

    - #### getBoundingBox

          Rect getBoundingBox()

      Returns the bounding box of this shape (will mark the bounds of the shape).
      Returns:
        The bounding box.

    - #### getCenter

          processing.core.PVector getCenter()

      Returns the center coordinate of this shape.
      Returns:
        The center coordinate of this shape.

    - #### getX

          java.lang.Float getX()

      Returns the x-position of the start coordinate for this shape. The start is defined differently for each shape. For a Line it is one of the ends, for a Rect it is the top left corner (when no rotation is applied) and so on.
      Returns:
        The x-position start coordinate for the shape.

    - #### getY

          java.lang.Float getY()

      Returns the y-position of the start coordinate for this shape. The start is defined differently for each shape. For a Line it is one of the ends, for a Rect it is the top left corner (when no rotation is applied) and so on.
      Returns:
        The y-position start coordinate for the shape.

    - #### getCoordinates

          processing.core.PVector[] getCoordinates()

      Returns all coordinates that defines this shape.
      Returns:
        The coordinates of this shape.

    - #### getRotation

          java.lang.Float getRotation()

      Returns the angle of shape.
      Returns:
        The angle of the shape.

    - #### setRotation

          RShape setRotation(float a)

      Rotates the shape to the given angle (past rotations will be overridden). The rotation center will be the getStart() of this shape.
      Parameters:
        `a` - The target rotation angle.
      Returns:
        The current shape.

    - #### setRotation

          RShape setRotation(processing.core.PVector c,
                             float a)

      Rotates the shape to the given angle (past rotations will be overridden). The rotation center will be the given location c.
      Parameters:
        `c` - The rotation center.
        `a` - The target rotation angle.
      Returns:
        The current shape.

    - #### setX

          RShape setX(float x)

      Translates the shape to the given x-location. After the translation getStart().x will be equal to the given x.
      Parameters:
        `x` - The new x-position of this shape.
      Returns:
        The current shape.

    - #### setY

          RShape setY(float y)

      Translates the shape to the given y-location. After the translation getStart().y will be equal to the given y.
      Parameters:
        `y` - The new y-position of this shape.
      Returns:
        The current shape.

    - #### setLocation

          RShape setLocation(float x,
                             float y)

      Translates the shape to the given location. After the translation getStart() will be equal to the given x, y.
      Parameters:
        `x` - The new x-position of this shape.
        `y` - The new y-position of this shape.
      Returns:
        The current shape.

    - #### copy

          RShape copy()

      Builds and returns a true copy of this shape.
      Returns:
        The copy of this shape.

    - #### translate

          RShape translate(float x,
                           float y)

      Translates the coordinates by the given parameters x, y ( "moves the shape by x, y").
      Parameters:
        `x` - The horizontal translation.
        `y` - The vertical translation.
      Returns:
        The current shape.

    - #### rotate

          RShape rotate(float a)

      Turns the shape through the given angle. The rotation center will be the getStart() of this shape.
      Parameters:
        `a` - The rotation angle.
      Returns:
        The current shape.

    - #### rotate

          RShape rotate(processing.core.PVector c,
                        float a)

      Turns the shape through the given angle. The rotation center will be the given location c.
      Parameters:
        `c` - The rotation center.
        `a` - The rotation angle.
      Returns:
        The current shape.

    - #### scale

          RShape scale(float s)

      Scale the shape by the given scaling factor. For scaling factor s <1 the shape will shrink. For scaling factor s>1 the shape will expand. The scaling center will be the getStart() of this shape.
      Parameters:
        `s` - The scaling factor (> 0).
      Returns:
        The current shape.

    - #### scale

          RShape scale(processing.core.PVector p,
                       float s)

      Scale the shape by the given scaling factor. For scaling factor s <1 the shape will shrink. For scaling factor s>1 the shape will expand. The scaling center will be the given location c.
      Parameters:
        `p` - The scaling center.
        `s` - The scaling factor (> 0).
      Returns:
        The current shape.

    - #### draw

          RShape draw()

      Draws the shape-
      Returns:
        The current shape.