com.jogamp.opengl.math.geom
Class AABBox

java.lang.Object
  extended by com.jogamp.opengl.math.geom.AABBox
All Implemented Interfaces:
Cloneable

public class AABBox
extends Object
implements Cloneable

Axis Aligned Bounding Box. Defined by two 3D coordinates (low and high) The low being the the lower left corner of the box, and the high being the upper right corner of the box.


Constructor Summary
AABBox()
          Create a Axis Aligned bounding box (AABBox) where the low and and high MAX float Values.
AABBox(float[] low, float[] high)
          Create a AABBox defining the low and high
AABBox(float lx, float ly, float lz, float hx, float hy, float hz)
          Create an AABBox specifying the coordinates of the low and high
 
Method Summary
 AABBox clone()
           
 boolean contains(float x, float y)
          Check if the x & y coordinates are bounded/contained by this AABBox
 boolean contains(float x, float y, float z)
          Check if the xyz coordinates are bounded/contained by this AABBox.
 boolean equals(Object obj)
           
 float[] getCenter()
          Get the Center of the AABBox
 float getDepth()
           
 float getHeight()
           
 float[] getHigh()
          Get the max xyz-coordinates
 float[] getLow()
          Get the min xyz-coordinates
 float getMaxX()
           
 float getMaxY()
           
 float getMaxZ()
           
 float getMinX()
           
 float getMinY()
           
 float getMinZ()
           
 float getSize()
          Get the size of the Box where the size is represented by the length of the vector between low and high.
 float getWidth()
           
 boolean intersects(float x, float y, float w, float h)
          Check if there is a common region between this AABBox and the passed 2D region irrespective of z range
 void reset()
          resets this box to the inverse low/high, allowing the next resize(float, float, float) command to hit.
 void resize(AABBox newBox)
          Resize the AABBox to encapsulate another AABox
 void resize(float[] xyz, int offset)
          Resize the AABBox to encapsulate the passed xyz-coordinates.
 void resize(float x, float y, float z)
          Resize the AABBox to encapsulate the passed xyz-coordinates.
 void scale(float size)
          Scale the AABBox by a constant
 void setSize(float lx, float ly, float lz, float hx, float hy, float hz)
          Set size of the AABBox specifying the coordinates of the low and high.
 String toString()
           
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AABBox

public AABBox()
Create a Axis Aligned bounding box (AABBox) where the low and and high MAX float Values.


AABBox

public AABBox(float lx,
              float ly,
              float lz,
              float hx,
              float hy,
              float hz)
Create an AABBox specifying the coordinates of the low and high

Parameters:
lx - min x-coordinate
ly - min y-coordnate
lz - min z-coordinate
hx - max x-coordinate
hy - max y-coordinate
hz - max z-coordinate

AABBox

public AABBox(float[] low,
              float[] high)
Create a AABBox defining the low and high

Parameters:
low - min xyz-coordinates
high - max xyz-coordinates
Method Detail

reset

public final void reset()
resets this box to the inverse low/high, allowing the next resize(float, float, float) command to hit.


getHigh

public final float[] getHigh()
Get the max xyz-coordinates

Returns:
a float array containing the max xyz coordinates

getLow

public final float[] getLow()
Get the min xyz-coordinates

Returns:
a float array containing the min xyz coordinates

setSize

public final void setSize(float lx,
                          float ly,
                          float lz,
                          float hx,
                          float hy,
                          float hz)
Set size of the AABBox specifying the coordinates of the low and high.

Parameters:
lx - min x-coordinate
ly - min y-coordnate
lz - min z-coordinate
hx - max x-coordinate
hy - max y-coordinate
hz - max z-coordinate

resize

public final void resize(AABBox newBox)
Resize the AABBox to encapsulate another AABox

Parameters:
newBox - AABBox to be encapsulated in

resize

public final void resize(float x,
                         float y,
                         float z)
Resize the AABBox to encapsulate the passed xyz-coordinates.

Parameters:
x - x-axis coordinate value
y - y-axis coordinate value
z - z-axis coordinate value

resize

public final void resize(float[] xyz,
                         int offset)
Resize the AABBox to encapsulate the passed xyz-coordinates.

Parameters:
xyz - xyz-axis coordinate values
offset - of the array

contains

public final boolean contains(float x,
                              float y)
Check if the x & y coordinates are bounded/contained by this AABBox

Parameters:
x - x-axis coordinate value
y - y-axis coordinate value
Returns:
true if x belong to (low.x, high.x) and y belong to (low.y, high.y)

contains

public final boolean contains(float x,
                              float y,
                              float z)
Check if the xyz coordinates are bounded/contained by this AABBox.

Parameters:
x - x-axis coordinate value
y - y-axis coordinate value
z - z-axis coordinate value
Returns:
true if x belong to (low.x, high.x) and y belong to (low.y, high.y) and z belong to (low.z, high.z)

intersects

public final boolean intersects(float x,
                                float y,
                                float w,
                                float h)
Check if there is a common region between this AABBox and the passed 2D region irrespective of z range

Parameters:
x - lower left x-coord
y - lower left y-coord
w - width
h - hight
Returns:
true if this AABBox might have a common region with this 2D region

getSize

public final float getSize()
Get the size of the Box where the size is represented by the length of the vector between low and high.

Returns:
a float representing the size of the AABBox

getCenter

public final float[] getCenter()
Get the Center of the AABBox

Returns:
the xyz-coordinates of the center of the AABBox

scale

public final void scale(float size)
Scale the AABBox by a constant

Parameters:
size - a constant float value

getMinX

public final float getMinX()

getMinY

public final float getMinY()

getMinZ

public final float getMinZ()

getMaxX

public final float getMaxX()

getMaxY

public final float getMaxY()

getMaxZ

public final float getMaxZ()

getWidth

public final float getWidth()

getHeight

public final float getHeight()

getDepth

public final float getDepth()

clone

public final AABBox clone()
Overrides:
clone in class Object

equals

public final boolean equals(Object obj)
Overrides:
equals in class Object

toString

public final String toString()
Overrides:
toString in class Object


Copyright 2010 JogAmp Community.