Package net.risingworld.api.utils
Class Bounds
java.lang.Object
net.risingworld.api.utils.Bounds
- All Implemented Interfaces:
Serializable
Describes a bounding volume, represented as an axis-aligned bounding
box (AABB), i.e the extends of the object along the x, y and z axis as well as the
position of the center of the object.
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Gets the bounds center.float
Gets the (half) extent along the x axis.float
Gets the (half) extent along the y axis.float
Gets the (half) extent along the z axis.int
hashCode()
boolean
isPointInVolume
(Vector3f point) Checks if the given point (represented as aVector3f
) is inside the bounds.toString()
Gets a String representation of the bounds.
-
Constructor Details
-
Bounds
public Bounds()Creates "empty" bounds. -
Bounds
Creates a new bounds object.- Parameters:
center
- the center of the bounds.xExtent
- the half extent along the x axis.yExtent
- the half extent along the y axis.zExtent
- the half extent along the z axis.
-
Bounds
public Bounds(float x, float y, float z, float xExtent, float yExtent, float zExtent) Creates a new bounds object.- Parameters:
x
- the x position of the bounds center.y
- the x position of the bounds center.z
- the x position of the bounds center.xExtent
- the half extent along the x axis.yExtent
- the half extent along the y axis.zExtent
- the half extent along the z axis.
-
-
Method Details
-
getXExtent
public float getXExtent()Gets the (half) extent along the x axis.- Returns:
- the extent along the x axis.
-
getYExtent
public float getYExtent()Gets the (half) extent along the y axis.- Returns:
- the extent along the y axis.
-
getZExtent
public float getZExtent()Gets the (half) extent along the z axis.- Returns:
- the extent along the z axis.
-
getCenter
Gets the bounds center.- Returns:
- the position of the center.
-
isPointInVolume
Checks if the given point (represented as aVector3f
) is inside the bounds.- Parameters:
point
- the point in 3d space (i.e world position).- Returns:
- true if the point is inside the bounds, false if not.
-
toString
Gets a String representation of the bounds. -
equals
-
hashCode
public int hashCode()
-