Class OrientedBoundingBox

java.lang.Object
com.ardor3d.bounding.BoundingVolume
com.ardor3d.bounding.OrientedBoundingBox
All Implemented Interfaces:
Savable, Serializable

public class OrientedBoundingBox extends BoundingVolume
See Also:
  • Field Details

    • _xAxis

      protected final Vector3 _xAxis
      X axis of the Oriented Box.
    • _yAxis

      protected final Vector3 _yAxis
      Y axis of the Oriented Box.
    • _zAxis

      protected final Vector3 _zAxis
      Z axis of the Oriented Box.
    • _extent

      protected final Vector3 _extent
      Extents of the box along the x,y,z axis.
    • _vectorStore

      protected final Vector3[] _vectorStore
      Vector array used to store the array of 8 corners the box has.
    • correctCorners

      public boolean correctCorners
      If true, the box's vectorStore array correctly represents the box's corners.
    • _compVect3

      protected final Vector3 _compVect3
  • Constructor Details

    • OrientedBoundingBox

      public OrientedBoundingBox()
  • Method Details

    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class BoundingVolume
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class BoundingVolume
    • getType

      public BoundingVolume.Type getType()
      Description copied from class: BoundingVolume
      getType returns the type of bounding volume this is.
      Specified by:
      getType in class BoundingVolume
      Returns:
      the type of bounding volume
    • transform

      public BoundingVolume transform(ReadOnlyTransform transform, BoundingVolume store)
      Description copied from class: BoundingVolume
      transform alters the location of the bounding volume by a transform.
      Specified by:
      transform in class BoundingVolume
      Parameters:
      transform - the transform
      store - the bounding volume used as a store
      Returns:
      the transformed bounding volume
    • whichSide

      public ReadOnlyPlane.Side whichSide(ReadOnlyPlane plane)
      Description copied from class: BoundingVolume
      whichSide returns the side on which the bounding volume lies on a plane. Possible values are POSITIVE_SIDE, NEGATIVE_SIDE, and NO_SIDE.
      Specified by:
      whichSide in class BoundingVolume
      Parameters:
      plane - the plane to check against this bounding volume.
      Returns:
      the side on which this bounding volume lies.
    • computeFromPoints

      public void computeFromPoints(FloatBuffer points)
      Description copied from class: BoundingVolume
      computeFromPoints generates a bounding volume that encompasses a collection of points.
      Specified by:
      computeFromPoints in class BoundingVolume
      Parameters:
      points - the points to contain.
    • merge

      public BoundingVolume merge(BoundingVolume volume)
      Description copied from class: BoundingVolume
      merge combines two bounding volumes into a single bounding volume that contains both this bounding volume and the parameter volume.
      Specified by:
      merge in class BoundingVolume
      Parameters:
      volume - the volume to combine.
      Returns:
      the new merged bounding volume.
    • mergeLocal

      public BoundingVolume mergeLocal(BoundingVolume volume)
      Description copied from class: BoundingVolume
      mergeLocal combines two bounding volumes into a single bounding volume that contains both this bounding volume and the parameter volume. The result is stored locally.
      Specified by:
      mergeLocal in class BoundingVolume
      Parameters:
      volume - the volume to combine.
      Returns:
      this
    • asType

      public BoundingVolume asType(BoundingVolume.Type newType)
      Description copied from class: BoundingVolume
      Convert this bounding volume to another, given bounding type.
      Specified by:
      asType in class BoundingVolume
      Parameters:
      newType - the type of bounding volume to convert to.
      Returns:
      a new bounding volume of the given type, containing this bounding volume.
    • clone

      public BoundingVolume clone(BoundingVolume store)
      Description copied from class: BoundingVolume
      clone creates a new BoundingVolume object containing the same data as this one.
      Specified by:
      clone in class BoundingVolume
      Parameters:
      store - where to store the cloned information. if null or wrong class, a new store is created.
      Returns:
      the new BoundingVolume
    • getRadius

      public double getRadius()
      Specified by:
      getRadius in class BoundingVolume
      Returns:
      the distance from the center of this bounding volume to its further edge/corner. Similar to converting this BoundingVolume to a sphere and asking for radius.
    • computeCorners

      public void computeCorners()
      Sets the vectorStore information to the 8 corners of the box.
    • computeFromPrimitives

      public void computeFromPrimitives(MeshData data, int section, int[] indices, int start, int end)
      Specified by:
      computeFromPrimitives in class BoundingVolume
    • intersection

      public boolean intersection(OrientedBoundingBox box1)
    • intersects

      public boolean intersects(BoundingVolume bv)
      Description copied from class: BoundingVolume
      determines if this bounding volume and a second given volume are intersecting. Intersecting being: one volume contains another, one volume overlaps another or one volume touches another.
      Specified by:
      intersects in class BoundingVolume
      Parameters:
      bv - the second volume to test against.
      Returns:
      true if this volume intersects the given volume.
    • intersectsSphere

      public boolean intersectsSphere(BoundingSphere bs)
      Description copied from class: BoundingVolume
      determines if this bounding volume and a given bounding sphere are intersecting.
      Specified by:
      intersectsSphere in class BoundingVolume
      Parameters:
      bs - the bounding sphere to test against.
      Returns:
      true if this volume intersects the given bounding sphere.
    • intersectsBoundingBox

      public boolean intersectsBoundingBox(BoundingBox bb)
      Description copied from class: BoundingVolume
      determines if this bounding volume and a given bounding box are intersecting.
      Specified by:
      intersectsBoundingBox in class BoundingVolume
      Parameters:
      bb - the bounding box to test against.
      Returns:
      true if this volume intersects the given bounding box.
    • intersectsOrientedBoundingBox

      public boolean intersectsOrientedBoundingBox(OrientedBoundingBox obb)
      Description copied from class: BoundingVolume
      determines if this bounding volume and a given bounding box are intersecting.
      Specified by:
      intersectsOrientedBoundingBox in class BoundingVolume
      Parameters:
      obb - the bounding box to test against.
      Returns:
      true if this volume intersects the given bounding box.
    • intersects

      public boolean intersects(ReadOnlyRay3 ray)
      Description copied from class: BoundingVolume
      determines if a ray intersects this bounding volume.
      Specified by:
      intersects in class BoundingVolume
      Parameters:
      ray - the ray to test.
      Returns:
      true if this volume is intersected by a given ray.
    • intersectsWhere

      public IntersectionRecord intersectsWhere(ReadOnlyRay3 ray)
      Description copied from class: BoundingVolume
      determines if a ray intersects this bounding volume and if so, where.
      Specified by:
      intersectsWhere in class BoundingVolume
      Parameters:
      ray - the ray to test.
      Returns:
      an IntersectionRecord containing information about any intersections made by the given Ray with this bounding
    • setXAxis

      public void setXAxis(ReadOnlyVector3 axis)
    • setYAxis

      public void setYAxis(ReadOnlyVector3 axis)
    • setZAxis

      public void setZAxis(ReadOnlyVector3 axis)
    • setExtent

      public void setExtent(ReadOnlyVector3 ext)
    • getXAxis

      public ReadOnlyVector3 getXAxis()
    • getYAxis

      public ReadOnlyVector3 getYAxis()
    • getZAxis

      public ReadOnlyVector3 getZAxis()
    • getExtent

      public ReadOnlyVector3 getExtent()
    • contains

      public boolean contains(ReadOnlyVector3 point)
      Description copied from class: BoundingVolume
      determines if a given point is contained within this bounding volume.
      Specified by:
      contains in class BoundingVolume
      Parameters:
      point - the point to check
      Returns:
      true if the point lies within this bounding volume.
    • distanceToEdge

      public double distanceToEdge(ReadOnlyVector3 point)
      Description copied from class: BoundingVolume
      Find the distance from the nearest edge of this Bounding Volume to the given point.
      Specified by:
      distanceToEdge in class BoundingVolume
      Parameters:
      point - The point to get the distance to
      Returns:
      distance
    • write

      public void write(OutputCapsule capsule) throws IOException
      Specified by:
      write in interface Savable
      Overrides:
      write in class BoundingVolume
      Throws:
      IOException
    • read

      public void read(InputCapsule capsule) throws IOException
      Specified by:
      read in interface Savable
      Overrides:
      read in class BoundingVolume
      Throws:
      IOException
    • getVolume

      public double getVolume()
      Specified by:
      getVolume in class BoundingVolume