org.scilab.forge.scirenderer.implementation.g2d.motor
Class BoundingBox

java.lang.Object
  extended by org.scilab.forge.scirenderer.implementation.g2d.motor.BoundingBox

public class BoundingBox
extends java.lang.Object

Author:
Calixte DENIZET Bounding box of a 3D object, useful to speed-up intersection detection.

Constructor Summary
BoundingBox(double minX, double maxX, double minY, double maxY, double minZ, double maxZ)
          Default constructor
 
Method Summary
static BoundingBox getBoundingBox(AbstractDrawable3DObject object)
          Get the bounding box of an object
 boolean isIntersecting(BoundingBox box)
           
 boolean isStrictlyIntersecting(BoundingBox box)
           
 java.lang.String toString()
           
 int xCompare(BoundingBox box)
          Get the relative x-position of this bounding-box and of the box
 int yCompare(BoundingBox box)
          Get the relative y-position of this bounding-box and of the box
 int zCompare(BoundingBox box)
          Get the relative z-position of this bounding-box and of the box
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BoundingBox

public BoundingBox(double minX,
                   double maxX,
                   double minY,
                   double maxY,
                   double minZ,
                   double maxZ)
Default constructor

Parameters:
minX - the minimal X
maxX - the maximal X
minY - the minimal Y
maxY - the maximal Y
minZ - the minimal Z
maxZ - the maximal Z
Method Detail

xCompare

public int xCompare(BoundingBox box)
Get the relative x-position of this bounding-box and of the box

Parameters:
box - a BoundingBox
Returns:
1 if box is on the right, -1 if on the left and 0 if nothing.

yCompare

public int yCompare(BoundingBox box)
Get the relative y-position of this bounding-box and of the box

Parameters:
box - a BoundingBox
Returns:
1 if box is on the bottom, -1 if on the top and 0 if nothing.

zCompare

public int zCompare(BoundingBox box)
Get the relative z-position of this bounding-box and of the box

Parameters:
box - a BoundingBox
Returns:
1 if box is on the front, -1 if behind and 0 if nothing.

isIntersecting

public boolean isIntersecting(BoundingBox box)
Parameters:
box - a BoundingBox
Returns:
true if this BoundingBox and the box have an intersection

isStrictlyIntersecting

public boolean isStrictlyIntersecting(BoundingBox box)
Parameters:
box - a BoundingBox
Returns:
true if this BoundingBox and the box have a strict intersection

getBoundingBox

public static BoundingBox getBoundingBox(AbstractDrawable3DObject object)
Get the bounding box of an object

Parameters:
object - a 3D object
Returns:
the corresponding bounding-box

toString

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