Class BoundingBox

java.lang.Object
de.ellpeck.rockbottom.api.util.BoundingBox

public final class BoundingBox extends Object
  • Constructor Details

    • BoundingBox

      public BoundingBox()
    • BoundingBox

      public BoundingBox(double minX, double minY, double maxX, double maxY)
  • Method Details

    • empty

      public static BoundingBox empty()
    • getCombinedBoundBox

      public static BoundingBox getCombinedBoundBox(List<BoundingBox> boxes)
    • set

      public BoundingBox set(BoundingBox box)
    • set

      public BoundingBox set(double minX, double minY, double maxX, double maxY)
    • add

      public BoundingBox add(double x, double y)
    • expand

      public BoundingBox expand(double x, double y)
    • expand

      public BoundingBox expand(double amount)
    • intersects

      public boolean intersects(BoundingBox other)
    • intersects

      public boolean intersects(double minX, double minY, double maxX, double maxY)
    • contains

      public boolean contains(double x, double y)
    • getIntersection

      public BoundingBox getIntersection(BoundingBox other)
    • getUnion

      public BoundingBox getUnion(BoundingBox other)
    • isEmpty

      public boolean isEmpty()
    • getBoundEdge

      public double getBoundEdge(Direction direction)
      Gets the position of an edge based on the direction. For example: box = BoundBox(-2.8, 0.2, 10.2, 11.5) box.getBoundEdge(Direction.UP) is 11.5. box.getBoundEdge(Direction.LEFT) is -2.8.
      Parameters:
      direction - The (CARDINAL) direction towards the edge
      Returns:
      The position value at that edge if direction is cardinal, 0 otherwise.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getMinX

      public double getMinX()
    • getMinY

      public double getMinY()
    • getMaxX

      public double getMaxX()
    • getMaxY

      public double getMaxY()
    • getWidth

      public double getWidth()
    • getHeight

      public double getHeight()
    • getArea

      public double getArea()
    • getCenterX

      public double getCenterX()
    • getCenterY

      public double getCenterY()
    • copy

      public BoundingBox copy()