j3d.org Aviatrix3D

org.j3d.aviatrix3d
Class BoundingVolume

java.lang.Object
  extended byorg.j3d.aviatrix3d.BoundingVolume
Direct Known Subclasses:
BoundingBox, BoundingGeometry, BoundingSphere, BoundingVoid

public abstract class BoundingVolume
extends java.lang.Object

Base representation of a class that can representing bound information.

Bounds describe a 3D volume, and various abstract intersection methods are defined. All methods must be implemented as various methods may be called during different parts of the rendering cycle. All bounds and rays are assumed to be represented in the same local coordinate space.

All intersection tests assume that the incoming picking details have been transformed to the local coordinate space that this volume exists in. The one exception to this rule is the view frustum intersection tests. The reason for this is performance - transforming 6 planes of the view matrix requires 6 matrix-vector multiplications, whereas by providing the reverse we only need to perform 2 matrix-vector mulitplications. Since view frustum culling is such a performance critical path of the rendering system we have decided to optimise for speed here rather than consistent API coding.

Version:
$Revision: 1.8 $
Author:
Justin Couch

Field Summary
static int BOX_BOUNDS
          The bounding volume type is sphere
static int FRUSTUM_ALLIN
          The frustum check revealed all points inside the frustum
static int FRUSTUM_ALLOUT
          The frustum check revealed all points outside the frustum
static int FRUSTUM_PARTIAL
          The frustum check revealed some points inside the frustum
static int GEOMETRY_BOUNDS
          The bounding volume type is user provided geometry
static int NULL_BOUNDS
          The bounding volume type is not valid (ie it has no bounds)
static int SPHERE_BOUNDS
          The bounding volume type is sphere
 
Constructor Summary
protected BoundingVolume()
          The default constructor.
 
Method Summary
abstract  int checkIntersectionFrustum(javax.vecmath.Vector4f[] planes, javax.vecmath.Matrix4d mat)
          Check whether this volume intersects with the view frustum.
abstract  int checkIntersectionFrustum(javax.vecmath.Vector4f[] planes, javax.vecmath.Matrix4f mat)
          Check whether this volume intersects with the view frustum.
abstract  boolean checkIntersectionPoint(float[] pos)
          Check for the given point lieing inside this bounds.
abstract  boolean checkIntersectionRay(float[] pos, float[] dir)
          Check for the given ray intersecting this bounds.
abstract  boolean checkIntersectionSegment(float[] start, float[] end)
          Check for the given line segment intersecting this bounds.
abstract  void getCenter(float[] center)
          Get the center of the bounding volume.
abstract  void getExtents(float[] min, float[] max)
          Get the maximum extents of the bounding volume.
abstract  int getType()
          The type of bounds this object represents.
abstract  void transform(javax.vecmath.Matrix4d mat)
          Transform the current postion by the given transformation matrix.
abstract  void transform(javax.vecmath.Matrix4f mat)
          Transform the current postion by the given transformation matrix.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NULL_BOUNDS

public static final int NULL_BOUNDS
The bounding volume type is not valid (ie it has no bounds)

See Also:
Constant Field Values

SPHERE_BOUNDS

public static final int SPHERE_BOUNDS
The bounding volume type is sphere

See Also:
Constant Field Values

BOX_BOUNDS

public static final int BOX_BOUNDS
The bounding volume type is sphere

See Also:
Constant Field Values

GEOMETRY_BOUNDS

public static final int GEOMETRY_BOUNDS
The bounding volume type is user provided geometry

See Also:
Constant Field Values

FRUSTUM_ALLOUT

public static final int FRUSTUM_ALLOUT
The frustum check revealed all points outside the frustum

See Also:
Constant Field Values

FRUSTUM_ALLIN

public static final int FRUSTUM_ALLIN
The frustum check revealed all points inside the frustum

See Also:
Constant Field Values

FRUSTUM_PARTIAL

public static final int FRUSTUM_PARTIAL
The frustum check revealed some points inside the frustum

See Also:
Constant Field Values
Constructor Detail

BoundingVolume

protected BoundingVolume()
The default constructor.

Method Detail

getType

public abstract int getType()
The type of bounds this object represents.

Returns:
One of the constant types defined

getExtents

public abstract void getExtents(float[] min,
                                float[] max)
Get the maximum extents of the bounding volume.

Parameters:
min - The minimum position of the bounds
max - The maximum position of the bounds

getCenter

public abstract void getCenter(float[] center)
Get the center of the bounding volume.

Parameters:
center - The center of the bounds will be copied here

checkIntersectionPoint

public abstract boolean checkIntersectionPoint(float[] pos)
Check for the given point lieing inside this bounds.

Parameters:
pos - The location of the point to test against
Returns:
true if the point lies inside this bounds

checkIntersectionRay

public abstract boolean checkIntersectionRay(float[] pos,
                                             float[] dir)
Check for the given ray intersecting this bounds. The line is described as a starting point and a vector direction.

Parameters:
pos - The start location of the ray
dir - The direction vector of the ray
Returns:
true if the ray intersects this bounds

checkIntersectionSegment

public abstract boolean checkIntersectionSegment(float[] start,
                                                 float[] end)
Check for the given line segment intersecting this bounds. The line is described as the line connecting the start and end points.

Parameters:
start - The start location of the segment
end - The start location of the segment
Returns:
true if the segment intersects this bounds

checkIntersectionFrustum

public abstract int checkIntersectionFrustum(javax.vecmath.Vector4f[] planes,
                                             javax.vecmath.Matrix4d mat)
Check whether this volume intersects with the view frustum.

Parameters:
planes - The 6 planes of the frustum
mat - The vworld to local transformation matrix
Returns:
int FRUSTUM_ALLOUT, FRUSTUM_ALLIN, FRUSTUM_PARTIAL.

checkIntersectionFrustum

public abstract int checkIntersectionFrustum(javax.vecmath.Vector4f[] planes,
                                             javax.vecmath.Matrix4f mat)
Check whether this volume intersects with the view frustum.

Parameters:
planes - The 6 planes of the frustum
mat - The vworld to local transformation matrix
Returns:
int FRUSTUM_ALLOUT, FRUSTUM_ALLIN, FRUSTUM_PARTIAL.

transform

public abstract void transform(javax.vecmath.Matrix4d mat)
Transform the current postion by the given transformation matrix.

Parameters:
mat - The matrix to transform this bounds by

transform

public abstract void transform(javax.vecmath.Matrix4f mat)
Transform the current postion by the given transformation matrix.

Parameters:
mat - The matrix to transform this bounds by

j3d.org Aviatrix3D

Latest Info from http://aviatrix3d.j3d.org/
Copyright © 2003 - j3d.org