gumbo.graphic.probe
Class AxisBound3

java.lang.Object
  |
  +--gumbo.graphic.probe.Bound3
        |
        +--gumbo.graphic.probe.AxisBound3
All Implemented Interfaces:
AxisBound3Boundable, BoundableGraphic, Graphic, GraphicGeometry, IntersectableGraphic, java.io.Serializable, TransformableGraphic

public class AxisBound3
extends Bound3
implements java.io.Serializable, AxisBound3Boundable, TransformableGraphic, IntersectableGraphic

A 3D axis-aligned box bound, whose position and extent are defined by a minimum and maximum point. Due to the nature of this bound the boundedness of a target graphic may not be preserved if transforms other than translation and scaling are used.

Version:
$Revision: 1.13 $
Author:
Jon Barrilleaux (jonb@jmbaai.com) of JMB and Associates Inc.
See Also:
Serialized Form

Constructor Summary
AxisBound3()
           
AxisBound3(Point3 pointA, Point3 pointB)
           
 
Method Summary
 boolean canIntersectGraphic(GraphicGeometry intersector)
          Returns true if the intersection operation between the intersector and this intersectable is supported.
 Point3 center(Point3 retVal)
          Returns the center of this bound.
 Bound3 clear()
          Clears the bound by clearing its components (zero position, zero volume) and setting it empty.
 AxisBound3 combine(AxisBound3 boundA, AxisBound3 boundB)
          Volumetrically combines two (possibly empty) bounds, and saves the result in this bounds.
 AxisBound3 combine(AxisBound3 bound, Point3 point)
          Volumetrically combines a (possibly empty) bound and a point, and saves the result in this bounds.
 boolean contains(AxisBound3 target)
          Returns true if a bound is completely contained by or is coincident with this bound.
 boolean contains(Point3 target)
          Returns true if a point is completely contained by or is coincident with this bound.
 boolean equals(java.lang.Object obj)
           
 AxisBound3 getAxisBound3()
          Gets a singleton immutable view of this object with the same identity (hashCode(), equals()) as this object.
 AxisBound3 getGraphicAxisBound3(AxisBound3 retVal)
          Returns the bound for this graphic.
 Point3 getMaxPoint()
          Returns an immutable view of the maximum point.
 Point3 getMinPoint()
          Returns an immutable view of the minimum point.
protected  AxisBound3 implClear()
          Master full state mutator.
protected  AxisBound3 implGetAxisBound3()
          Master full state accessor.
protected  Point3 implGetMaxPoint()
          Master partial state accessor.
protected  Point3 implGetMinPoint()
          Master partial state accessor.
protected  boolean implIsEmpty()
          Master partial state accessor.
protected  AxisBound3 implSet(Point3 pointA, Point3 pointB)
          Master full state mutator.
 AxisBound3 intersect(AxisBound3 boundA, AxisBound3 boundB)
          Volumetrically intersects two (possibly empty) bounds, and saves the result in this bound.
 boolean intersectGraphic(GraphicGeometry intersector)
          Returns true if the intersector intersects this intersectable.
 boolean isEmpty()
          Returns true if the bound is empty, because it has never been set, it has been cleared, or as the result of a null intersection.
 AxisBound3 offset(AxisBound3 bound, Tuple3 offset)
          Adds an offset to this bound's extents.
 Bound3 set(Bound3 bound)
          Copies the value of a (possibly empty) bound into this one.
 AxisBound3 set(Point3 pointA, Point3 pointB)
          Sets the extents of this bound as defined by two arbitrary points.
 AxisBound3 set(Point3 center, Size3 size)
          Sets this bound given the bound center point and size.
 Tuple3 size(Tuple3 retVal)
          Returns the size of this bound.
 java.lang.String toString()
           
 void transformGraphic(Matrix4 matrix)
          Transforms this graphic's geometry by pre-multiplying it with the specified transform matrix.
 void transformGraphic(SpaceNode from, SpaceNode to)
          Transforms this graphic's geometry from one local reference space to another in a space tree.
 
Methods inherited from class gumbo.graphic.probe.Bound3
getBound3, getGraphic, getGraphicLocalSpace
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface gumbo.graphic.space.GraphicGeometry
getGraphicLocalSpace
 
Methods inherited from interface gumbo.graphic.Graphic
getGraphic
 

Constructor Detail

AxisBound3

public AxisBound3()

AxisBound3

public AxisBound3(Point3 pointA,
                  Point3 pointB)
Method Detail

set

public final AxisBound3 set(Point3 pointA,
                            Point3 pointB)
Sets the extents of this bound as defined by two arbitrary points. Note that it is impossible to set a negative volume. Use clear() to set the volume empty.


set

public final AxisBound3 set(Point3 center,
                            Size3 size)
Sets this bound given the bound center point and size.


offset

public final AxisBound3 offset(AxisBound3 bound,
                               Tuple3 offset)
Adds an offset to this bound's extents.


intersect

public final AxisBound3 intersect(AxisBound3 boundA,
                                  AxisBound3 boundB)
Volumetrically intersects two (possibly empty) bounds, and saves the result in this bound. If the intersection is null, this bound will be cleared (empty).


combine

public final AxisBound3 combine(AxisBound3 bound,
                                Point3 point)
Volumetrically combines a (possibly empty) bound and a point, and saves the result in this bounds.


combine

public final AxisBound3 combine(AxisBound3 boundA,
                                AxisBound3 boundB)
Volumetrically combines two (possibly empty) bounds, and saves the result in this bounds.


getAxisBound3

public final AxisBound3 getAxisBound3()
Gets a singleton immutable view of this object with the same identity (hashCode(), equals()) as this object.

Returns:
The view. Never null.

getMinPoint

public final Point3 getMinPoint()
Returns an immutable view of the minimum point.


getMaxPoint

public final Point3 getMaxPoint()
Returns an immutable view of the maximum point.


size

public final Tuple3 size(Tuple3 retVal)
Returns the size of this bound.


center

public final Point3 center(Point3 retVal)
Returns the center of this bound.


contains

public final boolean contains(Point3 target)
Returns true if a point is completely contained by or is coincident with this bound. Returns false otherwise, or if this bound is empty.


contains

public final boolean contains(AxisBound3 target)
Returns true if a bound is completely contained by or is coincident with this bound. Returns false otherwise, or if this or the target bound is empty.


implSet

protected AxisBound3 implSet(Point3 pointA,
                             Point3 pointB)
Master full state mutator.


implClear

protected AxisBound3 implClear()
Master full state mutator.


implGetMinPoint

protected Point3 implGetMinPoint()
Master partial state accessor.


implGetMaxPoint

protected Point3 implGetMaxPoint()
Master partial state accessor.


implIsEmpty

protected boolean implIsEmpty()
Master partial state accessor.


implGetAxisBound3

protected AxisBound3 implGetAxisBound3()
Master full state accessor.


isEmpty

public final boolean isEmpty()
Description copied from class: Bound3
Returns true if the bound is empty, because it has never been set, it has been cleared, or as the result of a null intersection. Note that a zero volume bound is not neccessarily empty.

Specified by:
isEmpty in class Bound3
Returns:
True if the bound is empty.

set

public Bound3 set(Bound3 bound)
Copies the value of a (possibly empty) bound into this one.

Specified by:
set in class Bound3
Parameters:
bound - Bound to be copied. Never null.
Returns:
Reference to this bound. Never null.
Throws:
java.lang.UnsupportedOperationException - Bound must be an AxisBound3.

clear

public final Bound3 clear()
Description copied from class: Bound3
Clears the bound by clearing its components (zero position, zero volume) and setting it empty.

Specified by:
clear in class Bound3
Returns:
Reference to this bound. Never null.

getGraphicAxisBound3

public final AxisBound3 getGraphicAxisBound3(AxisBound3 retVal)
Description copied from interface: AxisBound3Boundable
Returns the bound for this graphic.

Specified by:
getGraphicAxisBound3 in interface AxisBound3Boundable
Parameters:
retVal - Return value object. The bound. Never null.
Returns:
Reference to retVal. Never null.

transformGraphic

public void transformGraphic(SpaceNode from,
                             SpaceNode to)
Description copied from interface: TransformableGraphic
Transforms this graphic's geometry from one local reference space to another in a space tree. Does not access or update this object's intrinsic reference space (which is returned by getGraphicLocalSpace()). If this graphic is spatially constrained some or all of the transformation may be ignored.

Specified by:
transformGraphic in interface TransformableGraphic
Parameters:
from - The current reference space. Never null.
to - The new reference space. Never null.

transformGraphic

public void transformGraphic(Matrix4 matrix)
Description copied from interface: TransformableGraphic
Transforms this graphic's geometry by pre-multiplying it with the specified transform matrix. As such, transformations are cumulative. If this graphic is spatially constrained some or all of the transformation may be ignored.

Specified by:
transformGraphic in interface TransformableGraphic
Parameters:
matrix - Value of the transform matrix. Never null.

canIntersectGraphic

public boolean canIntersectGraphic(GraphicGeometry intersector)
Description copied from interface: IntersectableGraphic
Returns true if the intersection operation between the intersector and this intersectable is supported. Should include tests for intersector type and space tree collocation.

Specified by:
canIntersectGraphic in interface IntersectableGraphic
Parameters:
intersector - Value of the intersector. Never null.
Returns:
True if the intersection is supported.

intersectGraphic

public boolean intersectGraphic(GraphicGeometry intersector)
Description copied from interface: IntersectableGraphic
Returns true if the intersector intersects this intersectable. Does not call canIntersectGraphic() but should throw an exception if the operation is unsupported (such as ClassCastException).

Specified by:
intersectGraphic in interface IntersectableGraphic
Parameters:
intersector - Value of the intersector. Never null.
Returns:
True if an intersection occurs.

toString

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

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class Bound3