edu.mines.jtk.sgl
Class BoxConstraint

java.lang.Object
  extended by edu.mines.jtk.sgl.BoxConstraint

public class BoxConstraint
extends java.lang.Object

A constraint for objects that must lie inside an axis-aligned box.

Version:
2006.05.25
Author:
Dave Hale, Colorado School of Mines

Constructor Summary
BoxConstraint(BoundingBox box)
          Constructs a box constraint with specified bounding box.
BoxConstraint(BoundingBox box, double dxmin, double dymin, double dzmin)
          Constructs a box constraint with specified bounding box and min sizes.
BoxConstraint(Point3 p, Point3 q)
          Constructs a box constraint with specified corner points.
BoxConstraint(Point3 p, Point3 q, double dxmin, double dymin, double dzmin)
          Constructs a box constraint with specified corner points and min sizes.
BoxConstraint(Sampling sx, Sampling sy, Sampling sz)
          Constructs a box constraint with specified samplings.
BoxConstraint(Sampling sx, Sampling sy, Sampling sz, double dxmin, double dymin, double dzmin)
          Constructs a box constraint with specified samplings and min sizes.
 
Method Summary
 void constrainBox(Point3 p, Point3 q)
          Constrains a box defined by two specified corner points.
 void constrainPoint(Point3 p)
          Constrains a specified point.
 boolean containsPoint(Point3 p)
          Determines whether this box constraint contains the specified point.
 BoundingBox getBoundingBox()
          Gets the bounding box for this constraint.
 BoundingSphere getBoundingSphere()
          Gets the bounding sphere for this constraint.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BoxConstraint

public BoxConstraint(BoundingBox box)
Constructs a box constraint with specified bounding box. Constrains objects to lie inside the bounding box.

Parameters:
box - bounding box.

BoxConstraint

public BoxConstraint(BoundingBox box,
                     double dxmin,
                     double dymin,
                     double dzmin)
Constructs a box constraint with specified bounding box and min sizes. Constrains objects to lie inside the bounding box.

Parameters:
box - bounding box.
dxmin - minimum size in x dimension.
dymin - minimum size in y dimension.
dzmin - minimum size in z dimension.

BoxConstraint

public BoxConstraint(Point3 p,
                     Point3 q)
Constructs a box constraint with specified corner points. Constrains objects to lie inside a box defined by the corner points.

Parameters:
p - a corner point.
q - a corner point.

BoxConstraint

public BoxConstraint(Point3 p,
                     Point3 q,
                     double dxmin,
                     double dymin,
                     double dzmin)
Constructs a box constraint with specified corner points and min sizes. Constrains objects to lie inside a box defined by the corner points.

Parameters:
p - a corner point.
q - a corner point.
dxmin - minimum size in x dimension.
dymin - minimum size in y dimension.
dzmin - minimum size in z dimension.

BoxConstraint

public BoxConstraint(Sampling sx,
                     Sampling sy,
                     Sampling sz)
Constructs a box constraint with specified samplings. Constrains objects vertices to lie on the sampling grid.

Parameters:
sx - sampling of x coordinate
sy - sampling of y coordinate
sz - sampling of z coordinate

BoxConstraint

public BoxConstraint(Sampling sx,
                     Sampling sy,
                     Sampling sz,
                     double dxmin,
                     double dymin,
                     double dzmin)
Constructs a box constraint with specified samplings and min sizes. Constrains object vertices to lie on the sampling grid.

Parameters:
sx - sampling of x coordinate
sy - sampling of y coordinate
sz - sampling of z coordinate
dxmin - minimum size in x dimension.
dymin - minimum size in y dimension.
dzmin - minimum size in z dimension.
Method Detail

getBoundingBox

public BoundingBox getBoundingBox()
Gets the bounding box for this constraint.

Returns:
the bounding box.

getBoundingSphere

public BoundingSphere getBoundingSphere()
Gets the bounding sphere for this constraint.

Returns:
the bounding sphere.

containsPoint

public boolean containsPoint(Point3 p)
Determines whether this box constraint contains the specified point.

Parameters:
p - the point
Returns:
true, if this box contains the point; false, otherwise.

constrainPoint

public void constrainPoint(Point3 p)
Constrains a specified point.

Parameters:
p - the point.

constrainBox

public void constrainBox(Point3 p,
                         Point3 q)
Constrains a box defined by two specified corner points. If necessary, modifies either or both of the points to satisfy this constraint.

Parameters:
p - a corner point
q - a corner point