Aviatrix3D
2.1.0

org.j3d.aviatrix3d
Class BoundingGeometry

java.lang.Object
  extended by org.j3d.aviatrix3d.rendering.BoundingVolume
      extended by org.j3d.aviatrix3d.BoundingGeometry

public class BoundingGeometry
extends BoundingVolume

Bounds described as an arbitrary piece of scene graph structure that is not rendered to screen.

In some cases, the scene graph prefers to use simplified proxy geometry to describe the bounds of an object, rather than using the exact geometry or bounding boxes. This allows the user to provide a custom set of bounds using normal scene graph geometry, without it being rendered.

Internally, this class holds no extra data other than the geometry it represents. Requests for the information such as extents, center, etc will ask the held geometry for it's top-level bounds object and compare against that. It does not walk the contained geometry tree for further checks. It is up to the internals of the scene graph API to do that. This is a holder for non-renderable geometry, not a complete internal picker.

Version:
$Revision: 1.12 $
Author:
Justin Couch

Field Summary
 
Fields inherited from class org.j3d.aviatrix3d.rendering.BoundingVolume
BOX_BOUNDS, FRUSTUM_ALLIN, FRUSTUM_ALLOUT, FRUSTUM_PARTIAL, GEOMETRY_BOUNDS, NULL_BOUNDS, SPHERE_BOUNDS
 
Constructor Summary
BoundingGeometry()
          The default constructor with no geometry set.
BoundingGeometry(Node geom)
          Construct a bounding sphere at the origin with a set radius.
 
Method Summary
 boolean checkIntersectionBox(float[] minExtents, float[] maxExtents)
          Check for the given AA box intersecting this bounds.
 boolean checkIntersectionCone(float[] vertex, float[] direction, float angle)
          Check for the given cone intersecting this bounds.
 boolean checkIntersectionCylinder(float[] center, float[] direction, float radius, float height)
          Check for the given cylinder segment intersecting this bounds.
 int checkIntersectionFrustum(javax.vecmath.Vector4f[] planes, javax.vecmath.Matrix4d mat)
          Check whether this volume intersects with the view frustum.
 int checkIntersectionFrustum(javax.vecmath.Vector4f[] planes, javax.vecmath.Matrix4f mat)
          Check whether this volume intersects with the view frustum.
 boolean checkIntersectionPoint(float[] pos)
          Check for the given point lieing inside this bounds.
 boolean checkIntersectionRay(float[] pos, float[] dir)
          Check for the given ray intersecting this bounds.
 boolean checkIntersectionSegment(float[] start, float[] end)
          Check for the given line segment intersecting this bounds.
 boolean checkIntersectionSphere(float[] center, float radius)
          Check for the given sphere intersecting this bounds.
 boolean checkIntersectionTriangle(float[] v0, float[] v1, float[] v2)
          Check for the given triangle intersecting this bounds.
 void getCenter(float[] center)
          Get the center of the bounding volume.
 void getExtents(float[] min, float[] max)
          Get the maximum extents of the bounding volume.
 Node getProxyGeometry()
          Get the currently used proxy geometry.
 int getType()
          The type of bounds this object represents.
 void setProxyGeometry(Node geom)
          Set the new geometry to use as the proxy.
 void transform(javax.vecmath.Matrix4d mat)
          Transform the current postion by the given transformation matrix.
 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
 

Constructor Detail

BoundingGeometry

public BoundingGeometry()
The default constructor with no geometry set.


BoundingGeometry

public BoundingGeometry(Node geom)
Construct a bounding sphere at the origin with a set radius.

Parameters:
geom - The geometry to use
Method Detail

getType

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

Specified by:
getType in class BoundingVolume
Returns:
One of the constant types defined

getExtents

public void getExtents(float[] min,
                       float[] max)
Get the maximum extents of the bounding volume. If there is no geometry currently set, all values are set to Float.NaN.

Specified by:
getExtents in class BoundingVolume
Parameters:
min - The minimum position of the bounds
max - The maximum position of the bounds

getCenter

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

Specified by:
getCenter in class BoundingVolume
Parameters:
center - The center of the bounds will be copied here

checkIntersectionPoint

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

Specified by:
checkIntersectionPoint in class BoundingVolume
Parameters:
pos - The location of the point to test against
Returns:
true if the point lies inside this bounds

checkIntersectionRay

public 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.

Specified by:
checkIntersectionRay in class BoundingVolume
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 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.

Specified by:
checkIntersectionSegment in class BoundingVolume
Parameters:
start - The start location of the segment
end - The start location of the segment
Returns:
true if the segment intersects this bounds

checkIntersectionSphere

public boolean checkIntersectionSphere(float[] center,
                                       float radius)
Check for the given sphere intersecting this bounds. The sphere is described by a centre location and the radius.

Specified by:
checkIntersectionSphere in class BoundingVolume
Parameters:
center - The location of the sphere's center
radius - The radius of the sphere
Returns:
true if the sphere intersects this bounds

checkIntersectionTriangle

public boolean checkIntersectionTriangle(float[] v0,
                                         float[] v1,
                                         float[] v2)
Check for the given triangle intersecting this bounds. Assumes the three coordinates of the triangle are declared in RH coordinate system.

Specified by:
checkIntersectionTriangle in class BoundingVolume
Parameters:
v0 - The first vertex of the triangle
v1 - The second vertex of the triangle
v2 - The third vertex of the triangle
Returns:
true if the sphere intersects this bounds

checkIntersectionCylinder

public boolean checkIntersectionCylinder(float[] center,
                                         float[] direction,
                                         float radius,
                                         float height)
Check for the given cylinder segment intersecting this bounds. The cylinder is described by a centre location, axial direction and the radius.

Specified by:
checkIntersectionCylinder in class BoundingVolume
Parameters:
center - The location of the cylinder's center
direction - A unit vector indicating the axial direction
radius - The radius of the cylinder
height - The half-height of the cylinder from the center point
Returns:
true if the sphere intersects this bounds

checkIntersectionCone

public boolean checkIntersectionCone(float[] vertex,
                                     float[] direction,
                                     float angle)
Check for the given cone intersecting this bounds. The cone is described by the location of the vertex, a direction vector and the spread angle of the cone.

Specified by:
checkIntersectionCone in class BoundingVolume
Parameters:
vertex - The location of the cone's vertex
direction - A unit vector indicating the axial direction
angle - The spread angle of the cone
Returns:
true if the sphere intersects this bounds

checkIntersectionBox

public boolean checkIntersectionBox(float[] minExtents,
                                    float[] maxExtents)
Check for the given AA box intersecting this bounds. The box is described by the minimum and maximum extents on each axis.

Specified by:
checkIntersectionBox in class BoundingVolume
Parameters:
minExtents - The minimum extent value on each axis
maxExtents - The maximum extent value on each axis
Returns:
true if the box intersects this bounds

checkIntersectionFrustum

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

Specified by:
checkIntersectionFrustum in class BoundingVolume
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 int checkIntersectionFrustum(javax.vecmath.Vector4f[] planes,
                                    javax.vecmath.Matrix4f mat)
Check whether this volume intersects with the view frustum.

Specified by:
checkIntersectionFrustum in class BoundingVolume
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 void transform(javax.vecmath.Matrix4d mat)
Transform the current postion by the given transformation matrix.

Specified by:
transform in class BoundingVolume
Parameters:
mat - The matrix to transform this bounds by

transform

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

Specified by:
transform in class BoundingVolume
Parameters:
mat - The matrix to transform this bounds by

setProxyGeometry

public void setProxyGeometry(Node geom)
Set the new geometry to use as the proxy. If a null value is passed, it will clear the currently set value.

Parameters:
geom - The new geometry instance to use or null

getProxyGeometry

public Node getProxyGeometry()
Get the currently used proxy geometry.

Returns:
The current geometry or null if none set

Aviatrix3D
2.1.0

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