org.ode4j.ode
Class DAABB

java.lang.Object
  extended by org.ode4j.ode.DAABB
All Implemented Interfaces:
DAABBC

public class DAABB
extends java.lang.Object
implements DAABBC

Convenience class for operations on AABB (Axis-aligned bounding boxes).

Axes are numbered from 0 to 2.

Author:
Tilmann Zaeschke
See Also:
DAABBC

Constructor Summary
DAABB()
           
 
Method Summary
 double avg0()
           
 double avg1()
           
 double avg2()
           
 void expand(DAABBC aabb)
          Expand this AABB to include the given AABB.
 void expand(DVector3C point)
          Expand this AABB to include the given point.
 DVector3 getCenter()
           
 DVector3 getLengths()
           
 double getMax(int i)
          Get maximum extension of axis
 double getMax0()
          get[1].
 double getMax1()
          get[3].
 double getMax2()
          get[5].
 double getMin(int i)
          Get minimum extension of axis
 double getMin0()
          get[0].
 double getMin1()
          get[2].
 double getMin2()
          get[4].
 boolean isDisjoint(DAABBC aabb2)
          Checks whether the to AABBs are disjoint.
 boolean isValid()
           
 double len0()
           
 double len1()
           
 double len2()
           
 void set(DAABBC aabb)
           
 void set(double min0, double max0, double min1, double max1, double min2, double max2)
           
 void setMax(DVector3C max)
           
 void setMax0(double d)
           
 void setMax1(double d)
           
 void setMax2(double d)
           
 void setMin(DVector3C min)
           
 void setMin0(double d)
           
 void setMin1(double d)
           
 void setMin2(double d)
           
 void setMinMax(double mm0, double mm1, double mm2)
          Set the minimum and maximum values to -+ the given parameters.
 void setMinMax(DVector3C v1, DVector3C v2)
          Determines the AABB from a box defined by the two vectors.
 void setToInfinity()
          Set the minimum and maximum values to -infinity and infinity.
 void setZero()
           
 void shiftPos(DVector3C pos)
          Move this AABB by pos.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DAABB

public DAABB()
Method Detail

setToInfinity

public void setToInfinity()
Set the minimum and maximum values to -infinity and infinity.


setMinMax

public void setMinMax(double mm0,
                      double mm1,
                      double mm2)
Set the minimum and maximum values to -+ the given parameters.


shiftPos

public void shiftPos(DVector3C pos)
Move this AABB by pos.

Parameters:
pos -

len0

public double len0()
Specified by:
len0 in interface DAABBC

len1

public double len1()
Specified by:
len1 in interface DAABBC

len2

public double len2()
Specified by:
len2 in interface DAABBC

avg0

public double avg0()

avg1

public double avg1()

avg2

public double avg2()

isValid

public boolean isValid()
Specified by:
isValid in interface DAABBC
Returns:
false is any of the values is NaN.

isDisjoint

public boolean isDisjoint(DAABBC aabb2)
Checks whether the to AABBs are disjoint.

Specified by:
isDisjoint in interface DAABBC
Parameters:
aabb2 -
Returns:
false if the two AABBs overlap.

setMinMax

public void setMinMax(DVector3C v1,
                      DVector3C v2)
Determines the AABB from a box defined by the two vectors.

Parameters:
v1 -
v2 -

setMin0

public void setMin0(double d)

setMin1

public void setMin1(double d)

setMin2

public void setMin2(double d)

setMax0

public void setMax0(double d)

setMax1

public void setMax1(double d)

setMax2

public void setMax2(double d)

getMin0

public double getMin0()
get[0].

Specified by:
getMin0 in interface DAABBC

getMin1

public double getMin1()
get[2].

Specified by:
getMin1 in interface DAABBC

getMin2

public double getMin2()
get[4].

Specified by:
getMin2 in interface DAABBC

getMax0

public double getMax0()
get[1].

Specified by:
getMax0 in interface DAABBC

getMax1

public double getMax1()
get[3].

Specified by:
getMax1 in interface DAABBC

getMax2

public double getMax2()
get[5].

Specified by:
getMax2 in interface DAABBC

getMax

public double getMax(int i)
Description copied from interface: DAABBC
Get maximum extension of axis

Specified by:
getMax in interface DAABBC
Parameters:
i - The axis (0, 1 or 2)

getMin

public double getMin(int i)
Description copied from interface: DAABBC
Get minimum extension of axis

Specified by:
getMin in interface DAABBC
Parameters:
i - The axis (0, 1 or 2)

getLengths

public DVector3 getLengths()
Specified by:
getLengths in interface DAABBC
Returns:
the lengths of this AABB as a vector.

getCenter

public DVector3 getCenter()
Specified by:
getCenter in interface DAABBC
Returns:
the center of this AABB.

set

public void set(DAABBC aabb)

set

public void set(double min0,
                double max0,
                double min1,
                double max1,
                double min2,
                double max2)

setZero

public void setZero()

setMin

public void setMin(DVector3C min)

setMax

public void setMax(DVector3C max)

expand

public void expand(DVector3C point)
Expand this AABB to include the given point.

Parameters:
point -

expand

public void expand(DAABBC aabb)
Expand this AABB to include the given AABB.

Parameters:
aabb -

toString

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