com.quinncurtis.chart3djava
Class ChartRectangle3D

java.lang.Object
  extended by com.quinncurtis.chart3djava.ChartRectangle3D
Direct Known Subclasses:
ChartRectangle2D

public class ChartRectangle3D
extends java.lang.Object

A simple 3D rectangle class, analogous to the java Rectangle2D.Double class.


Constructor Summary
ChartRectangle3D()
          The default ChartRectangle3D constructor
ChartRectangle3D(ChartRectangle3D r)
          This constructor creates an ChartRectangle3D object based on the properties of a ChartRectangle3D object.
ChartRectangle3D(double xx, double yy, double ww, double hh)
          This constructor creates an ChartRectangle3D object defined by its position, height and width.
ChartRectangle3D(double xx, double yy, double zz, double ww, double hh, double dd)
          This constructor creates an ChartRectangle3D object defined by its position, height and width.
ChartRectangle3D(java.awt.Rectangle r)
          This constructor creates an ChartRectangle3D object based on the properties of a RectangleF object.
ChartRectangle3D(java.awt.geom.Rectangle2D.Float r)
          This constructor creates an ChartRectangle3D object based on the properties of a RectangleF object.
 
Method Summary
 java.lang.Object clone()
          Returns an object that is a clone of this ChartRectangle3D object.
 boolean contains(ChartPoint3D p)
          Returns true if the point p is contained in the rectangle.
 boolean contains(ChartRectangle3D testr)
          Returns true if the rectangle testr is contained by the rectangle.
 boolean contains(double xx, double yy)
          Returns true if the point (xx,yy) is contained in the rectangle.
 boolean contains(double xx, double yy, double zz)
          Returns true if the point (xx,yy) is contained in the rectangle.
 void copy(ChartRectangle3D source)
          Copies the source ChartRectangle3D object.
 void fixRectangle()
          Adjust the rectangle to enforce positive height, width and depth.
 double getCenterX()
          Returns the x-value of the center of the rectangle.
 double getCenterY()
          Returns the y-value of the center of the rectangle.
 double getCenterZ()
          Returns the z-value of the center of the rectangle.
 double getDepth()
          Returns the depth of the rectangle.
 ChartPoint3D getDiagonalCorner()
          This method returns the corner opposite the x,y position of the rectangle.
 double getHeight()
          Returns the height of the rectangle.
 java.awt.Rectangle getRectangle()
          Returns the the position and size of the rectangle as a Rectangle object.
 java.awt.geom.Rectangle2D.Double getRectangleD()
          Returns the the position and size of the rectangle as a RectangleF object.
 java.awt.geom.Rectangle2D.Float getRectangleF()
          Returns the the position and size of the rectangle as a RectangleF object.
 double getWidth()
          Returns the width of the rectangle.
 double getX()
          Returns the upper left of the rectangle.
 double getX1()
          Returns the upper left x-position of the rectangle.
 double getX2()
          Returns the lower right x-position of the rectangle.
 double getY()
          Returns the upper left y-position of the rectangle.
 double getY1()
          Returns the upper left y-position of the rectangle.
 double getY2()
          Returns the lower right y-position of the rectangle.
 double getZ()
          Returns the upper left z-position of the rectangle.
 double getZ1()
          Returns the upper left z-position of the rectangle.
 double getZ2()
          Returns the lower right z-position of the rectangle.
 boolean intersectsWith(ChartRectangle3D rect)
          Returns true if the specifie rectangle intersects the current rectangle.
 boolean intersectsWith2(ChartRectangle3D testr)
          Returns true if the rectangle testr intersects the rectangle.
 void normalizeHW()
          Defines the position and size of the ChartRectangle3D object.
 void setDepth(double value)
          Sets the depth of the rectangle.
 void setDiagonalCorner(ChartPoint3D p)
          Sets the corner opposite the x,y position of the rectangle.
 void setFrame(ChartRectangle3D r)
          Defines the position and size of the ChartRectangle3D object.
 void setFrame(double xx, double yy, double ww, double hh)
          Defines the position and size of the ChartRectangle3D object.
 void setFrame(double xx, double yy, double zz, double ww, double hh, double dd)
          Defines the position and size of the ChartRectangle3D object.
 void setFrame(java.awt.Rectangle r)
          Defines the position and size of the ChartRectangle3D object.
 void setFrame(java.awt.geom.Rectangle2D.Double r)
          Defines the position and size of the ChartRectangle3D object.
 void setFrame(java.awt.geom.Rectangle2D.Float r)
          Defines the position and size of the ChartRectangle3D object.
 void setFrameFromDiaglonal(double x1, double y1, double x2, double y2)
          Defines the position and size of the ChartRectangle3D object.
 void setFrameFromDiaglonal(double x1, double y1, double z1, double x2, double y2, double z2)
          Defines the position and size of the ChartRectangle3D object.
 void setFrameFromDiagonal(ChartPoint3D p1, ChartPoint3D p2)
          Initializes a rectangle object based on a pair of opposite corners.
 void setFrameFromDiagonal(double x1, double y1, double x2, double y2)
          Initializes a rectangle object based on a pair of opposite corners.
 void setFrameFromDiagonal(double x1, double y1, double z1, double x2, double y2, double z2)
          Initializes a rectangle object based on a pair of opposite corners.
 void setHeight(double value)
          Sets the height of the rectangle.
 void setLocation(double xx, double yy)
          Defines the position the ChartRectangle3D object.
 void setLocation(double xx, double yy, double zz)
          Defines the position the ChartRectangle3D object.
 void setWidth(double value)
          Sets the width of the rectangle.
 void setX1(double xx)
          Sets the upper left x-position of the rectangle.
 void setX2(double x2)
          Sets the lower right x-position of the rectangle.
 void setY1(double yy)
          Sets the upper left y-position of the rectangle.
 void setY2(double y2)
          Sets the lower right y-position of the rectangle.
 void setZ1(double zz)
          Sets the upper left z-position of the rectangle.
 void setZ2(double z2)
          Sets the lower right z-position of the rectangle.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ChartRectangle3D

public ChartRectangle3D()
The default ChartRectangle3D constructor


ChartRectangle3D

public ChartRectangle3D(double xx,
                        double yy,
                        double zz,
                        double ww,
                        double hh,
                        double dd)
This constructor creates an ChartRectangle3D object defined by its position, height and width.

Parameters:
xx - The x-position of the upper left of the rectangle.
yy - The y-position of the upper left of the rectangle.
zz - The z-position of the upper left of the rectangle.
ww - w The width of the rectangle.
hh - h The height of the rectangle.
dd - h The depth of the rectangle.

ChartRectangle3D

public ChartRectangle3D(double xx,
                        double yy,
                        double ww,
                        double hh)
This constructor creates an ChartRectangle3D object defined by its position, height and width.

Parameters:
xx - The x-position of the upper left of the rectangle.
yy - The y-position of the upper left of the rectangle.
ww - w The width of the rectangle.
hh - h The height of the rectangle.

ChartRectangle3D

public ChartRectangle3D(ChartRectangle3D r)
This constructor creates an ChartRectangle3D object based on the properties of a ChartRectangle3D object.

Parameters:
r - The source rectangle.

ChartRectangle3D

public ChartRectangle3D(java.awt.geom.Rectangle2D.Float r)
This constructor creates an ChartRectangle3D object based on the properties of a RectangleF object.

Parameters:
r - The source rectangle.

ChartRectangle3D

public ChartRectangle3D(java.awt.Rectangle r)
This constructor creates an ChartRectangle3D object based on the properties of a RectangleF object.

Parameters:
r - The source rectangle.
Method Detail

copy

public void copy(ChartRectangle3D source)
Copies the source ChartRectangle3D object.

Parameters:
source - The source ChartRectangle3D object.

clone

public java.lang.Object clone()
Returns an object that is a clone of this ChartRectangle3D object.

Overrides:
clone in class java.lang.Object
Returns:
Returns a clone of this ChartRectangle3D object.

normalizeHW

public void normalizeHW()
Defines the position and size of the ChartRectangle3D object.


setFrame

public void setFrame(double xx,
                     double yy,
                     double zz,
                     double ww,
                     double hh,
                     double dd)
Defines the position and size of the ChartRectangle3D object.

Parameters:
xx - The x-position of the upper left of the rectangle.
yy - The y-position of the upper left of the rectangle.
zz - The z-position of the upper left of the rectangle.
ww - The width of the rectangle.
hh - The height of the rectangle.
dd - The depth of the rectangle.

setFrame

public void setFrame(double xx,
                     double yy,
                     double ww,
                     double hh)
Defines the position and size of the ChartRectangle3D object.

Parameters:
xx - The x-position of the upper left of the rectangle.
yy - The y-position of the upper left of the rectangle.
ww - The width of the rectangle.
hh - The height of the rectangle.

setFrame

public void setFrame(ChartRectangle3D r)
Defines the position and size of the ChartRectangle3D object.

Parameters:
r - Specifies the size of the rectangle.

setFrame

public void setFrame(java.awt.Rectangle r)
Defines the position and size of the ChartRectangle3D object.

Parameters:
r - Specifies the size of the rectangle.

setFrame

public void setFrame(java.awt.geom.Rectangle2D.Float r)
Defines the position and size of the ChartRectangle3D object.

Parameters:
r - Specifies the size of the rectangle.

setFrame

public void setFrame(java.awt.geom.Rectangle2D.Double r)
Defines the position and size of the ChartRectangle3D object.

Parameters:
r - Specifies the size of the rectangle.

setFrameFromDiaglonal

public void setFrameFromDiaglonal(double x1,
                                  double y1,
                                  double z1,
                                  double x2,
                                  double y2,
                                  double z2)
Defines the position and size of the ChartRectangle3D object.

Parameters:
x1 - The x-position of the upper left of the rectangle.
y1 - The y-position of the upper left of the rectangle.
z1 - The z-position of the upper left of the rectangle.
x2 - The x-position of the opposite corner of the rectangle.
y2 - The y-position of the opposite corner of the rectangle.
z2 - The z-position of the opposite corner of the rectangle.

setFrameFromDiaglonal

public void setFrameFromDiaglonal(double x1,
                                  double y1,
                                  double x2,
                                  double y2)
Defines the position and size of the ChartRectangle3D object.

Parameters:
x1 - The x-position of the upper left of the rectangle.
y1 - The y-position of the upper left of the rectangle.
x2 - The x-position of the opposite corner of the rectangle.
y2 - The y-position of the opposite corner of the rectangle.

setLocation

public void setLocation(double xx,
                        double yy,
                        double zz)
Defines the position the ChartRectangle3D object.

Parameters:
xx - The x-position of the upper left of the rectangle.
yy - The y-position of the upper left of the rectangle.
zz - The z-position of the upper left of the rectangle.

setLocation

public void setLocation(double xx,
                        double yy)
Defines the position the ChartRectangle3D object.

Parameters:
xx - The x-position of the upper left of the rectangle.
yy - The y-position of the upper left of the rectangle.

setDiagonalCorner

public void setDiagonalCorner(ChartPoint3D p)
Sets the corner opposite the x,y position of the rectangle.

Parameters:
p - A point defining the position of lower right corner of the rectangle.

getDiagonalCorner

public ChartPoint3D getDiagonalCorner()
This method returns the corner opposite the x,y position of the rectangle.

Returns:
Returns a point defining the position of the lower right corner of the rectangle.

setFrameFromDiagonal

public void setFrameFromDiagonal(double x1,
                                 double y1,
                                 double z1,
                                 double x2,
                                 double y2,
                                 double z2)
Initializes a rectangle object based on a pair of opposite corners.

Parameters:
x1 - The x-position of the upper left of the rectangle.
y1 - The y-position of the upper left of the rectangle.
z1 - The z-position of the upper left of the rectangle.
x2 - The x-position of the lower right of the rectangle.
y2 - The y-position of the lower right of the rectangle.
z2 - The z-position of the lower right of the rectangle.

setFrameFromDiagonal

public void setFrameFromDiagonal(ChartPoint3D p1,
                                 ChartPoint3D p2)
Initializes a rectangle object based on a pair of opposite corners.

Parameters:
p1 - The position of the upper left of the rectangle.
p2 - The position of the lower right of the rectangle.

setFrameFromDiagonal

public void setFrameFromDiagonal(double x1,
                                 double y1,
                                 double x2,
                                 double y2)
Initializes a rectangle object based on a pair of opposite corners.

Parameters:
x1 - The x-position of the upper left of the rectangle.
y1 - The y-position of the upper left of the rectangle.
x2 - The x-position of the lower right of the rectangle.
y2 - The y-position of the lower right of the rectangle.

fixRectangle

public void fixRectangle()
Adjust the rectangle to enforce positive height, width and depth.


getX

public double getX()
Returns the upper left of the rectangle.

Returns:
Returns the upper left x-position of the rectangle.

getY

public double getY()
Returns the upper left y-position of the rectangle.

Returns:
Returns the upper left y-position of the rectangle.

getZ

public double getZ()
Returns the upper left z-position of the rectangle.

Returns:
Returns the upper left z-position of the rectangle.

getX1

public double getX1()
Returns the upper left x-position of the rectangle.

Returns:
Returns the upper left x-position of the rectangle.

getY1

public double getY1()
Returns the upper left y-position of the rectangle.

Returns:
Returns the upper left y-position of the rectangle.

getZ1

public double getZ1()
Returns the upper left z-position of the rectangle.

Returns:
Returns the upper left z-position of the rectangle.

getWidth

public double getWidth()
Returns the width of the rectangle.

Returns:
Returns the width of the rectangle.

getHeight

public double getHeight()
Returns the height of the rectangle.

Returns:
Returns the height of the rectangle.

getDepth

public double getDepth()
Returns the depth of the rectangle.

Returns:
Returns the depth of the rectangle.

setWidth

public void setWidth(double value)
Sets the width of the rectangle.

Parameters:
value - Sets the width of the rectangle.

setHeight

public void setHeight(double value)
Sets the height of the rectangle.

Parameters:
value - Sets the height of the rectangle.

setDepth

public void setDepth(double value)
Sets the depth of the rectangle.

Parameters:
value - Sets the depth of the rectangle.

getX2

public double getX2()
Returns the lower right x-position of the rectangle.

Returns:
Returns the lower right x-position of the rectangle.

getY2

public double getY2()
Returns the lower right y-position of the rectangle.

Returns:
Returns the lower right y-position of the rectangle.

getZ2

public double getZ2()
Returns the lower right z-position of the rectangle.

Returns:
Returns the lower right z-position of the rectangle.

setX1

public void setX1(double xx)
Sets the upper left x-position of the rectangle.

Parameters:
xx - Sets the upper left x-position of the rectangle.

setY1

public void setY1(double yy)
Sets the upper left y-position of the rectangle.

Parameters:
yy - Sets the upper left y-position of the rectangle.

setZ1

public void setZ1(double zz)
Sets the upper left z-position of the rectangle.

Parameters:
zz - Sets the upper left y-position of the rectangle.

setX2

public void setX2(double x2)
Sets the lower right x-position of the rectangle.

Parameters:
x2 - Sets the lower right x-position of the rectangle.

setY2

public void setY2(double y2)
Sets the lower right y-position of the rectangle.

Parameters:
y2 - Sets the lower right y-position of the rectangle.

setZ2

public void setZ2(double z2)
Sets the lower right z-position of the rectangle.

Parameters:
z2 - Sets the lower right z-position of the rectangle.

getCenterX

public double getCenterX()
Returns the x-value of the center of the rectangle.

Returns:
Returns the x-value of the center of the rectangle.

getCenterY

public double getCenterY()
Returns the y-value of the center of the rectangle.

Returns:
Returns the y-value of the center of the rectangle .

getCenterZ

public double getCenterZ()
Returns the z-value of the center of the rectangle.

Returns:
Returns the z-value of the center of the rectangle .

getRectangleF

public java.awt.geom.Rectangle2D.Float getRectangleF()
Returns the the position and size of the rectangle as a RectangleF object.

Returns:
Returns the position and size of the rectangle as a RectangleF object.

getRectangleD

public java.awt.geom.Rectangle2D.Double getRectangleD()
Returns the the position and size of the rectangle as a RectangleF object.

Returns:
Returns the position and size of the rectangle as a RectangleF object.

getRectangle

public java.awt.Rectangle getRectangle()
Returns the the position and size of the rectangle as a Rectangle object.

Returns:
Returns the position and size of the rectangle as a Rectangle object.

contains

public boolean contains(double xx,
                        double yy,
                        double zz)
Returns true if the point (xx,yy) is contained in the rectangle.

Parameters:
xx - The x-value of the test point.
yy - The y-value of the test point.
zz - The z-value of the test point.
Returns:
Returns true if the point (xx,yy,zz) is contained in the rectangle.

contains

public boolean contains(double xx,
                        double yy)
Returns true if the point (xx,yy) is contained in the rectangle.

Parameters:
xx - The x-value of the test point.
yy - The y-value of the test point.
Returns:
Returns true if the point (xx,yy) is contained in the rectangle.

contains

public boolean contains(ChartPoint3D p)
Returns true if the point p is contained in the rectangle.

Parameters:
p - The test point.
Returns:
Returns true if the point p is contained in the rectangle.

intersectsWith

public boolean intersectsWith(ChartRectangle3D rect)
Returns true if the specifie rectangle intersects the current rectangle.

Parameters:
rect - The test rectangle.
Returns:
Returns true if the specifie rectangle intersects the current rectangle.

intersectsWith2

public boolean intersectsWith2(ChartRectangle3D testr)
Returns true if the rectangle testr intersects the rectangle.

Parameters:
testr - The test rectangle.
Returns:
Returns true if the rectangle testr intersects the rectangle.

contains

public boolean contains(ChartRectangle3D testr)
Returns true if the rectangle testr is contained by the rectangle.

Parameters:
testr - The test rectangle.
Returns:
Returns true if the rectangle testr is contained by the rectangle.