Class BoundingBox

java.lang.Object
net.glowstone.entity.physics.BoundingBox
All Implemented Interfaces:
Cloneable
Direct Known Subclasses:
BlockBoundingBox, EntityBoundingBox

public class BoundingBox extends Object implements Cloneable
A rectangular bounding box with minimum and maximum corners.
  • Field Details

    • minCorner

      public final org.bukkit.util.Vector minCorner
    • maxCorner

      public final org.bukkit.util.Vector maxCorner
  • Constructor Details

    • BoundingBox

      public BoundingBox()
  • Method Details

    • intersects

      public static boolean intersects(BoundingBox a, BoundingBox b)
      Tests whether two bounding boxes intersect.
      Parameters:
      a - a bounding box
      b - a bounding box
      Returns:
      true if a and b intersect; false otherwise
    • intersects

      public final boolean intersects(BoundingBox other)
      Tests whether this intersects another bounding box.
      Parameters:
      other - another bounding box
      Returns:
      true if this bounding box and other intersect; false otherwise
    • fromCorners

      public static BoundingBox fromCorners(org.bukkit.util.Vector a, org.bukkit.util.Vector b)
      Converts two Vector instances to a BoundingBox.
      Parameters:
      a - any corner
      b - the corner opposite a
      Returns:
      a bounding box from a to b
    • fromPositionAndSize

      public static BoundingBox fromPositionAndSize(org.bukkit.util.Vector pos, org.bukkit.util.Vector size)
      Creates a bounding box given its minimum corner and its size.
      Parameters:
      pos - the minimum corner
      size - the displacement of the maximum corner from the minimum corner
      Returns:
      a bounding box from pos to pos.clone().add(size)
    • copyOf

      public static BoundingBox copyOf(BoundingBox original)
      Returns a deep copy of a BoundingBox.
      Parameters:
      original - the BoundingBox to copy
      Returns:
      a copy of original
    • getSize

      public org.bukkit.util.Vector getSize()
      Returns the displacement of the maximum corner from the minimum corner.
      Returns:
      the displacement of the maximum corner from the minimum corner