## Class BoundingBox

- java.lang.Object
- - BoundingBox

-     public class BoundingBox
      extends java.lang.Object

  An instance is a 2D bounding box.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `Vector2D` | `lower` The corner of the bounding box with the smaller x,y coordinates.
    `Vector2D` | `upper` The corner of the bounding box with the larger x,y coordinates.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `BoundingBox(BoundingBox b)` Constructor: an instance is a copy of bounding box b.
    `BoundingBox(Vector2D lower, Vector2D upper)` Constructor: An instance with lower as smaller coordinates and upper as larger coordinates.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `contains(Vector2D p)` Return true iff this bounding box contains p.
    `BoundingBox` | `displaced(Vector2D d)` Return the result of displacing this bounding box by d.
    `static BoundingBox` | `findBBox(java.util.Iterator<Block> iter)` Return the bounding box of blocks given by iter.
    `double` | `getArea()` Return the area of this bounding box.
    `Vector2D` | `getCenter()` Return the center of this bounding box.
    `double` | `getHeight()` Return the height of this bounding box (along y-dimension).
    `double` | `getLength()` Return the larger of the width and height of this bounding box.
    `double` | `getWidth()` Return the width of this bounding box (along x-dimension).
    `boolean` | `overlaps(BoundingBox box)` Return true iff this bounding box overlaps with box.
    `java.lang.String` | `toString()` Return a representation of this bounding box.

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

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

- - ### Field Detail

    - #### lower

          public Vector2D lower

      The corner of the bounding box with the smaller x,y coordinates.

    - #### upper

          public Vector2D upper

      The corner of the bounding box with the larger x,y coordinates.

  - ### Constructor Detail

    - #### BoundingBox

          public BoundingBox(BoundingBox b)

      Constructor: an instance is a copy of bounding box b.

    - #### BoundingBox

          public BoundingBox(Vector2D lower,
                     Vector2D upper)

      Constructor: An instance with lower as smaller coordinates and upper as larger coordinates.

  - ### Method Detail

    - #### getWidth

          public double getWidth()

      Return the width of this bounding box (along x-dimension).

    - #### getHeight

          public double getHeight()

      Return the height of this bounding box (along y-dimension).

    - #### getLength

          public double getLength()

      Return the larger of the width and height of this bounding box.

    - #### getCenter

          public Vector2D getCenter()

      Return the center of this bounding box.

    - #### displaced

          public BoundingBox displaced(Vector2D d)

      Return the result of displacing this bounding box by d.

    - #### contains

          public boolean contains(Vector2D p)

      Return true iff this bounding box contains p.

    - #### getArea

          public double getArea()

      Return the area of this bounding box.

    - #### overlaps

          public boolean overlaps(BoundingBox box)

      Return true iff this bounding box overlaps with box.

    - #### findBBox

          public static BoundingBox findBBox(java.util.Iterator<Block> iter)

      Return the bounding box of blocks given by iter.

    - #### toString

          public java.lang.String toString()

      Return a representation of this bounding box.
      Overrides:
        `toString` in class `java.lang.Object`