Package net.glowstone.entity.physics
Class BoundingBox
java.lang.Object
net.glowstone.entity.physics.BoundingBox
- All Implemented Interfaces:
Cloneable
- Direct Known Subclasses:
BlockBoundingBox
,EntityBoundingBox
A rectangular bounding box with minimum and maximum corners.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic BoundingBox
copyOf
(BoundingBox original) Returns a deep copy of a BoundingBox.static BoundingBox
fromCorners
(org.bukkit.util.Vector a, org.bukkit.util.Vector b) Converts two Vector instances to a BoundingBox.static BoundingBox
fromPositionAndSize
(org.bukkit.util.Vector pos, org.bukkit.util.Vector size) Creates a bounding box given its minimum corner and its size.org.bukkit.util.Vector
getSize()
Returns the displacement of the maximum corner from the minimum corner.final boolean
intersects
(BoundingBox other) Tests whether this intersects another bounding box.static boolean
intersects
(BoundingBox a, BoundingBox b) Tests whether two bounding boxes intersect.
-
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
Tests whether two bounding boxes intersect.- Parameters:
a
- a bounding boxb
- a bounding box- Returns:
- true if
a
andb
intersect; false otherwise
-
intersects
Tests whether this intersects another bounding box.- Parameters:
other
- another bounding box- Returns:
- true if this bounding box and
other
intersect; false otherwise
-
fromCorners
Converts two Vector instances to a BoundingBox.- Parameters:
a
- any cornerb
- the corner oppositea
- Returns:
- a bounding box from
a
tob
-
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 cornersize
- the displacement of the maximum corner from the minimum corner- Returns:
- a bounding box from
pos
topos.clone().add(size)
-
copyOf
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
-