artofillusion.math
Class BoundingBox

java.lang.Object
  extended by artofillusion.math.BoundingBox

public class BoundingBox
extends java.lang.Object

The BoundingBox class describes a 3-dimensional rectangular box which is aligned with the coordinate axes.


Field Summary
 double maxx
           
 double maxy
           
 double maxz
           
 double minx
           
 double miny
           
 double minz
           
 
Constructor Summary
BoundingBox(BoundingBox b)
          Create a new BoundingBox identical to another one.
BoundingBox(double x1, double x2, double y1, double y2, double z1, double z2)
          Create a BoundingBox by specifying the upper and lower values along the X, Y, and Z axes.
BoundingBox(Vec3 p1, Vec3 p2)
          Create a BoundingBox by specifying two opposite corners.
 
Method Summary
 boolean contains(Vec3 p)
          Determine whether the given point lies inside the box.
 double distanceToPoint(Vec3 p)
          Determine the distance between a point and the closest point in the box.
 void extend(BoundingBox b)
          Extend this bounding box to also contain the contents of another one.
 Vec3 getCenter()
          Get a vector to the center of the box.
 Vec3[] getCorners()
          Get an array containing the coordinates of the corners of the box.
 Vec3 getSize()
          Get a vector containing the dimensions of the box.
 boolean intersects(BoundingBox b)
          Determine whether two bounding boxes intersect each other.
 BoundingBox merge(BoundingBox b)
          Return a new bounding box which contains both this box and another specified one.
 void outset(double dist)
          Outset the bounding box by a fixed amount in every direction.
 java.lang.String toString()
           
 BoundingBox transformAndOutset(Mat4 m)
          This method applies a transformation matrix M to each of the eight corners of the box, then generates a new BoundingBox which is large enough to contain the transformed box.
 BoundingBox translate(double dx, double dy, double dz)
          Return a new bounding box which is translated from this one by the specified amount.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

minx

public double minx

maxx

public double maxx

miny

public double miny

maxy

public double maxy

minz

public double minz

maxz

public double maxz
Constructor Detail

BoundingBox

public BoundingBox(double x1,
                   double x2,
                   double y1,
                   double y2,
                   double z1,
                   double z2)
Create a BoundingBox by specifying the upper and lower values along the X, Y, and Z axes.


BoundingBox

public BoundingBox(Vec3 p1,
                   Vec3 p2)
Create a BoundingBox by specifying two opposite corners.


BoundingBox

public BoundingBox(BoundingBox b)
Create a new BoundingBox identical to another one.

Method Detail

getSize

public Vec3 getSize()
Get a vector containing the dimensions of the box.


getCenter

public Vec3 getCenter()
Get a vector to the center of the box.


getCorners

public Vec3[] getCorners()
Get an array containing the coordinates of the corners of the box.


merge

public BoundingBox merge(BoundingBox b)
Return a new bounding box which contains both this box and another specified one.


extend

public void extend(BoundingBox b)
Extend this bounding box to also contain the contents of another one.


contains

public final boolean contains(Vec3 p)
Determine whether the given point lies inside the box.


intersects

public final boolean intersects(BoundingBox b)
Determine whether two bounding boxes intersect each other.


distanceToPoint

public final double distanceToPoint(Vec3 p)
Determine the distance between a point and the closest point in the box.


outset

public final void outset(double dist)
Outset the bounding box by a fixed amount in every direction.


translate

public final BoundingBox translate(double dx,
                                   double dy,
                                   double dz)
Return a new bounding box which is translated from this one by the specified amount.


transformAndOutset

public final BoundingBox transformAndOutset(Mat4 m)
This method applies a transformation matrix M to each of the eight corners of the box, then generates a new BoundingBox which is large enough to contain the transformed box.


toString

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


Copyright © 1999-2011 by Peter Eastman.