ProGAL.geom3d.volumes
Class OBB

java.lang.Object
  extended by ProGAL.geom3d.volumes.OBB
All Implemented Interfaces:
Shape, Volume

public class OBB
extends java.lang.Object
implements Volume


Field Summary
 double[] extents
           
 
Constructor Summary
OBB(Point anchor, Vector[] bases, double[] extents)
           
OBB(Point anchor, Vector xdir, Vector ydir, Vector zdir)
           
 
Method Summary
 OBB clone()
          Make a deep clone this volume.
static OBB createBoundingBox_Covariance(PointList points)
           
static OBB createBoxFromBases(Vector[] bases, java.util.List<Point> points)
          Creates a bounding box enclosing the points in points using the supplied bases.
 double cutArealYZ()
           
 Point getAnchor()
           
 Vector[] getBases()
           
 Point getCenter()
          Get the geometric center of the shape.
 Point[] getVertices()
           
 double getVolume()
          Get the volume.
 Vector getXDir()
           
 Vector getYDir()
           
 Vector getZDir()
           
 boolean overlaps(OBB b)
          Returns true iff this box has an overlap with b.
 boolean overlaps(Volume s)
          Determine if this volume overlaps vol.
 void setAnchor(Point pos)
           
 java.lang.String toString()
           
 double volume()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

extents

public double[] extents
Constructor Detail

OBB

public OBB(Point anchor,
           Vector xdir,
           Vector ydir,
           Vector zdir)

OBB

public OBB(Point anchor,
           Vector[] bases,
           double[] extents)
Method Detail

getAnchor

public Point getAnchor()

getXDir

public Vector getXDir()

getYDir

public Vector getYDir()

getZDir

public Vector getZDir()

getBases

public Vector[] getBases()

setAnchor

public void setAnchor(Point pos)

cutArealYZ

public double cutArealYZ()

createBoundingBox_Covariance

public static OBB createBoundingBox_Covariance(PointList points)

createBoxFromBases

public static OBB createBoxFromBases(Vector[] bases,
                                     java.util.List<Point> points)
Creates a bounding box enclosing the points in points using the supplied bases.


overlaps

public boolean overlaps(OBB b)
Returns true iff this box has an overlap with b. Uses the separating axis implementation described in "Realtime collision detection" by Christer Ericsson. 30 -> 27+9+9+18+54=117HOps


getCenter

public Point getCenter()
Description copied from interface: Shape
Get the geometric center of the shape. The center of a shape can be interpreted in many ways (center of mass, circumcenter, inscribed center etc.). No strict requirement is given here, but typically the circumcenter should be supplied. This method is most prominently used to find the average center-position of a collection of shapes such that scene-viewers can be centered on the scene.

Specified by:
getCenter in interface Shape

getVertices

public Point[] getVertices()

overlaps

public boolean overlaps(Volume s)
Description copied from interface: Volume
Determine if this volume overlaps vol. Two volumes overlap if their surfaces touch or if the union of interiors is non-empty.

Specified by:
overlaps in interface Volume

volume

public double volume()

clone

public OBB clone()
Description copied from interface: Volume
Make a deep clone this volume.

Specified by:
clone in interface Volume
Overrides:
clone in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getVolume

public double getVolume()
Description copied from interface: Volume
Get the volume.

Specified by:
getVolume in interface Volume