Class Box3D

java.lang.Object
  |
  +--java.awt.geom.RectangularShape
        |
        +--java.awt.geom.Rectangle2D
              |
              +--java.awt.Rectangle
                    |
                    +--Box3D
All Implemented Interfaces:
java.lang.Cloneable, java.io.Serializable, java.awt.Shape

public class Box3D
extends java.awt.Rectangle

Box3D.java - Creates an object that represents a 3d box by extending the java.awt.Rectangle class.

Version:
4/18/2001
Author:
Grant William Braught, Dickinson College
See Also:
Serialized Form

Inner classes inherited from class java.awt.geom.Rectangle2D
java.awt.geom.Rectangle2D.Double, java.awt.geom.Rectangle2D.Float
 
Fields inherited from class java.awt.Rectangle
height, width, x, y
 
Fields inherited from class java.awt.geom.Rectangle2D
OUT_BOTTOM, OUT_LEFT, OUT_RIGHT, OUT_TOP
 
Constructor Summary
Box3D(int x, int y, int z, int width, int height, int depth)
          Constructs a new 3dBox whose front-upper-left corner is at (x,y,z), with width, height and depth specified.
 
Method Summary
 boolean contains(Box3D box)
          Determine if the 3dBox is within this 3dBox.
 boolean contains(int x, int y, int z)
          Determines if the point (x,y,z) is within the box.
 boolean equals(Box3D box)
          Determines if this box the specified box are equal.
 int getDepth()
          Returns the depth of the 3d box.
 int getVolume()
          Compute the volume of the 3D box.
 int getZ()
          Returns the z coordinate of the 3d box.
 void setLocation(int x, int y, int z)
          Set the location of the box.
 void setSize(int width, int height, int depth)
          Set the size of the box.
 java.lang.String toString()
          Returns a Sring representing this 3 dimensional box.
 
Methods inherited from class java.awt.Rectangle
, add, add, add, contains, contains, contains, contains, createIntersection, createUnion, equals, getBounds, getBounds2D, getHeight, getLocation, getSize, getWidth, getX, getY, grow, inside, intersection, intersects, isEmpty, move, outcode, reshape, resize, setBounds, setBounds, setLocation, setLocation, setRect, setSize, setSize, translate, union
 
Methods inherited from class java.awt.geom.Rectangle2D
add, add, add, contains, contains, getPathIterator, getPathIterator, hashCode, intersect, intersects, intersectsLine, intersectsLine, outcode, setFrame, setRect, union
 
Methods inherited from class java.awt.geom.RectangularShape
clone, contains, contains, getCenterX, getCenterY, getFrame, getMaxX, getMaxY, getMinX, getMinY, intersects, setFrame, setFrame, setFrameFromCenter, setFrameFromCenter, setFrameFromDiagonal, setFrameFromDiagonal
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.awt.Shape
contains, contains, contains, contains, getPathIterator, getPathIterator, intersects, intersects
 

Constructor Detail

Box3D

public Box3D(int x,
             int y,
             int z,
             int width,
             int height,
             int depth)
Constructs a new 3dBox whose front-upper-left corner is at (x,y,z), with width, height and depth specified.
Parameters:
x - x coordinate of front-upper-left corner.
y - y coordinate of front-upper-left corner.
z - z coordinate of front-upper-left corner.
width - width of the box.
height - height of the box.
depth - depth of the box.
Method Detail

contains

public boolean contains(Box3D box)
Determine if the 3dBox is within this 3dBox.
Returns:
true if the specified box is inside this box; false otherwise.

contains

public boolean contains(int x,
                        int y,
                        int z)
Determines if the point (x,y,z) is within the box.
Returns:
true if (x,y,z) is contained within this box; false otherwise.

equals

public boolean equals(Box3D box)
Determines if this box the specified box are equal.
Returns:
true if this box and box are equal; false otherwise.

getDepth

public int getDepth()
Returns the depth of the 3d box.
Returns:
the depth of this box.

getVolume

public int getVolume()
Compute the volume of the 3D box.
Returns:
the volume of this box.

getZ

public int getZ()
Returns the z coordinate of the 3d box.
Returns:
the z coordinate of this box.

setLocation

public void setLocation(int x,
                        int y,
                        int z)
Set the location of the box.
Parameters:
x - x coordinate of front-upper-left corner.
y - y coordinate of front-upper-left corner.
z - z coordinate of front-upper-left corner.

setSize

public void setSize(int width,
                    int height,
                    int depth)
Set the size of the box.
Parameters:
width - width of the box.
height - height of the box.
depth - depth of the box.

toString

public java.lang.String toString()
Returns a Sring representing this 3 dimensional box.
Overrides:
toString in class java.awt.Rectangle
Returns:
a String representation of this box.