Class OrientedBoundingBox

  • All Implemented Interfaces:
    java.io.Serializable

    public class OrientedBoundingBox
    extends java.lang.Object
    implements java.io.Serializable
    See Also:
    Serialized Form
    • Field Detail

      • transform

        public final Matrix4 transform
        Transform matrix.
    • Constructor Detail

      • OrientedBoundingBox

        public OrientedBoundingBox()
        Constructs a new oriented bounding box with the minimum and maximum vector set to zeros.
      • OrientedBoundingBox

        public OrientedBoundingBox​(BoundingBox bounds)
        Constructs a new oriented bounding box from the given bounding box.
        Parameters:
        bounds - The bounding box to copy
      • OrientedBoundingBox

        public OrientedBoundingBox​(BoundingBox bounds,
                                   Matrix4 transform)
        Constructs a new oriented bounding box from the given bounding box and transform.
        Parameters:
        bounds - The bounding box to copy
        transform - The transformation matrix to copy
    • Method Detail

      • getVertices

        public Vector3[] getVertices()
      • getBounds

        public BoundingBox getBounds()
        Get the current bounds. Call update() if you manually change this bounding box.
      • setBounds

        public void setBounds​(BoundingBox bounds)
        Sets the base bounds of the oriented bounding box as the bounds given, the transform is applied to the vertices.
        Parameters:
        bounds - The bounding box to copy
      • getTransform

        public Matrix4 getTransform()
        Get the current transformation matrix. Call update() if you manually change this matrix.
      • setTransform

        public void setTransform​(Matrix4 transform)
      • contains

        public boolean contains​(Vector3 v)
        Returns whether the given vector is contained in this oriented bounding box.
        Parameters:
        v - The vector
        Returns:
        Whether the vector is contained or not.
      • contains

        public boolean contains​(BoundingBox b)
        Returns whether the given bounding box is contained in this oriented bounding box.
        Parameters:
        b - The bounding box
        Returns:
        Whether the given bounding box is contained
      • contains

        public boolean contains​(OrientedBoundingBox obb)
        Returns whether the given oriented bounding box is contained in this oriented bounding box.
        Parameters:
        obb - The oriented bounding box
        Returns:
        Whether the given oriented bounding box is contained
      • intersects

        public boolean intersects​(BoundingBox b)
        Returns whether the given bounding box is intersecting this oriented bounding box (at least one point in).
        Parameters:
        b - The bounding box
        Returns:
        Whether the given bounding box is intersected
      • intersects

        public boolean intersects​(OrientedBoundingBox obb)
        Returns whether the given oriented bounding box is intersecting this oriented bounding box (at least one point in).
        Parameters:
        obb - The oriented bounding box
        Returns:
        Whether the given bounding box is intersected
      • mul

        public void mul​(Matrix4 transform)