Class Bounds

java.lang.Object
net.risingworld.api.utils.Bounds
All Implemented Interfaces:
Serializable

public class Bounds extends Object implements 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

    Constructors
    Constructor
    Description
    Creates "empty" bounds.
    Bounds(float x, float y, float z, float xExtent, float yExtent, float zExtent)
    Creates a new bounds object.
    Bounds(Vector3f center, float xExtent, float yExtent, float zExtent)
    Creates a new bounds object.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
     
    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
     
    boolean
    Checks if the given point (represented as a Vector3f) is inside the bounds.
    Gets a String representation of the bounds.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • Bounds

      public Bounds()
      Creates "empty" bounds.
    • Bounds

      public Bounds(Vector3f center, float xExtent, float yExtent, float zExtent)
      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

      public Vector3f getCenter()
      Gets the bounds center.
      Returns:
      the position of the center.
    • isPointInVolume

      public boolean isPointInVolume(Vector3f point)
      Checks if the given point (represented as a Vector3f) 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

      public String toString()
      Gets a String representation of the bounds.
      Overrides:
      toString in class Object
      Returns:
      a string representing the bounds.
    • equals

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

      public int hashCode()
      Overrides:
      hashCode in class Object