public abstract class Rectangle3D extends java.lang.Object implements Shape3D, java.lang.Cloneable
Modifier and Type | Class and Description |
---|---|
static class |
Rectangle3D.Double |
static class |
Rectangle3D.Float |
static class |
Rectangle3D.Integer |
Constructor and Description |
---|
Rectangle3D() |
Modifier and Type | Method and Description |
---|---|
void |
add(double newx,
double newy,
double newz)
Adds a 3D point, specified by the double precision coordinates arguments, to this
Rectangle3D . |
void |
add(Point3D pt)
Adds the
Point3D object pt to this Rectangle3D . |
void |
add(Rectangle3D r)
Adds a
Rectangle3D object to this Rectangle3D . |
java.lang.Object |
clone()
Creates a new object of the same class as this object.
|
boolean |
contains(double x,
double y,
double z)
Tests if the specified coordinates are inside the boundary of the
Rectangle3D . |
boolean |
contains(double x,
double y,
double z,
double sizeX,
double sizeY,
double sizeZ)
Tests if the
Rectangle3D entirely contains the specified 3D rectangular area. |
boolean |
contains(Point3D p)
Tests if a specified
Point3D is inside the boundary
of the Shape3D . |
boolean |
contains(Rectangle3D rect)
Tests if the
Rectangle3D entirely contains the specified Rectangle3D . |
abstract Rectangle3D |
createIntersection(Rectangle3D r)
Returns a new
Rectangle3D object representing the intersection of this Rectangle3D with
the specified Rectangle3D . |
abstract Rectangle3D |
createUnion(Rectangle3D r)
Returns a new
Rectangle3D object representing the union of this Rectangle3D with the
specified Rectangle3D . |
boolean |
equals(java.lang.Object obj) |
Rectangle3D |
getBounds()
Returns the bounding box of the
Shape3D . |
double |
getCenterX()
Returns the X coordinate of the center of the rectangle.
|
double |
getCenterY()
Returns the Y coordinate of the center of the rectangle.
|
double |
getCenterZ()
Returns the Z coordinate of the center of the rectangle.
|
abstract Dimension3D |
getDimension()
Returns the dimension.
|
double |
getMaxX()
Returns the largest X coordinate of the rectangle.
|
double |
getMaxY()
Returns the largest Y coordinate of the rectangle.
|
double |
getMaxZ()
Returns the largest Z coordinate of the rectangle.
|
double |
getMinX()
Returns the smallest X coordinate of the rectangle.
|
double |
getMinY()
Returns the smallest Y coordinate of the rectangle.
|
double |
getMinZ()
Returns the smallest Z coordinate of the rectangle.
|
abstract Point3D |
getPosition()
Returns the point coordinates.
|
abstract double |
getSizeX()
Returns the size of X dimension.
|
abstract double |
getSizeY()
Returns the size of Y dimension.
|
abstract double |
getSizeZ()
Returns the size of Z dimension.
|
abstract double |
getX()
Returns the minimum X coordinate.
|
abstract double |
getY()
Returns the minimum Y coordinate.
|
abstract double |
getZ()
Returns the minimum Z coordinate.
|
int |
hashCode() |
static Rectangle3D |
intersect(Rectangle3D src1,
Rectangle3D src2,
Rectangle3D dest)
Intersects the pair of specified source
Rectangle3D objects and puts the result
into the specified destination Rectangle3D object. |
boolean |
intersects(double x,
double y,
double z,
double sizeX,
double sizeY,
double sizeZ)
Tests if the interior of the
Rectangle3D intersects the interior of a specified
3D rectangular area. |
static boolean |
intersects(Line3D line,
Rectangle3D rect)
Returns
true if the specified Line3D intersects the given Rectangle3D. |
boolean |
intersects(Rectangle3D rect)
Tests if the interior of the
Rectangle3D intersects the interior of a specified
Rectangle3D . |
boolean |
intersectsLine(double x1,
double y1,
double z1,
double x2,
double y2,
double z2)
Tests if the specified 3D line intersects this
Rectangle3D . |
boolean |
intersectsLine(Line3D line)
Tests if the specified 3D line intersects this
Rectangle3D . |
boolean |
intersectsLine(Point3D pt1,
Point3D pt2)
Tests if the line specified by the given starting and ending Point intersects the plan defined by this
Rectangle3D . |
boolean |
isEmpty()
Determines whether the
Rectangle5D is empty. |
boolean |
isInfiniteX()
Returns
true if the X dimension should be considered as infinite. |
boolean |
isInfiniteY()
Returns
true if the Y dimension should be considered as infinite. |
boolean |
isInfiniteZ()
Returns
true if the Z dimension should be considered as infinite. |
void |
setInfiniteX()
Sets the X dimension to infinite.
|
void |
setInfiniteY()
Sets the Y dimension to infinite.
|
void |
setInfiniteZ()
Sets the Z dimension to infinite.
|
abstract void |
setRect(double x,
double y,
double z,
double sizeX,
double sizeY,
double sizeZ)
Sets the position and size of this
Rectangle3D to the specified double values. |
abstract void |
setSizeX(double value)
Sets the size of X dimension.
|
abstract void |
setSizeY(double value)
Sets the size of Y dimension.
|
abstract void |
setSizeZ(double value)
Sets the size of Z dimension.
|
abstract void |
setX(double x)
Sets the minimum X coordinate.
|
abstract void |
setY(double y)
Sets the minimum Y coordinate.
|
abstract void |
setZ(double z)
Sets the minimum Z coordinate.
|
Rectangle3D.Integer |
toInteger()
Returns an integer
Rectangle3D that completely encloses the
double Rectangle . |
abstract java.awt.geom.Rectangle2D |
toRectangle2D()
Convert to 2D rectangle
|
java.lang.String |
toString() |
static Rectangle3D |
union(Rectangle3D src1,
Rectangle3D src2,
Rectangle3D dest)
Unions the pair of source
Rectangle3D objects and puts the result into the
specified destination Rectangle3D object. |
public Rectangle3D()
public static boolean intersects(Line3D line, Rectangle3D rect)
true
if the specified Line3D intersects the given Rectangle3D.line
- the Line3D we want to test intersection forrect
- the Rectangle3D we want to test intersection forpublic static Rectangle3D intersect(Rectangle3D src1, Rectangle3D src2, Rectangle3D dest)
Rectangle3D
objects and puts the result
into the specified destination Rectangle3D
object. One of the source rectangles
can also be the destination to avoid creating a third Rectangle3D object, but in this case
the original points of this source rectangle will be overwritten by this method.src1
- the first of a pair of Rectangle3D
objects to be intersected with each
othersrc2
- the second of a pair of Rectangle3D
objects to be intersected with each
otherdest
- the Rectangle3D
that holds the
results of the intersection of src1
and src2
public abstract Rectangle3D createIntersection(Rectangle3D r)
Rectangle3D
object representing the intersection of this Rectangle3D
with
the specified Rectangle3D
.r
- the Rectangle3D
to be intersected with this Rectangle3D
Rectangle3D
contained in both the specified Rectangle3D
and in this
Rectangle3D
.public static Rectangle3D union(Rectangle3D src1, Rectangle3D src2, Rectangle3D dest)
Rectangle3D
objects and puts the result into the
specified destination Rectangle3D
object. One of the source rectangles can also
be the destination to avoid creating a third Rectangle3D object, but in this case the
original points of this source rectangle will be overwritten by this method.src1
- the first of a pair of Rectangle3D
objects to be combined with each othersrc2
- the second of a pair of Rectangle3D
objects to be combined with each
otherdest
- the Rectangle3D
that holds the
results of the union of src1
and src2
public abstract Rectangle3D createUnion(Rectangle3D r)
Rectangle3D
object representing the union of this Rectangle3D
with the
specified Rectangle3D
.r
- the Rectangle3D
to be combined with this Rectangle3D
Rectangle3D
containing both the specified Rectangle3D
and this
Rectangle3D
.public abstract void setRect(double x, double y, double z, double sizeX, double sizeY, double sizeZ)
Rectangle3D
to the specified double
values.x
- the X coordinate of the minimum corner position of this Rectangle3D
y
- the Y coordinate of the minimum corner position of this Rectangle3D
z
- the Z coordinate of the minimum corner position of this Rectangle3D
sizeX
- size for X dimension of this Rectangle3D
sizeY
- size for Y dimension of this Rectangle3D
sizeZ
- size for Z dimension of this Rectangle3D
public abstract double getX()
public abstract double getY()
public abstract double getZ()
public abstract Point3D getPosition()
public abstract Dimension3D getDimension()
public abstract double getSizeX()
public abstract double getSizeY()
public abstract double getSizeZ()
public Rectangle3D.Integer toInteger()
Rectangle3D
that completely encloses the
double Rectangle
. The returned Rectangle
might also fail to
completely enclose the original double Rectangle
if it overflows
the limited range of the integer data type.Rectangle
that completely encloses
the actual double Rectangle
.public abstract void setX(double x)
public abstract void setY(double y)
public abstract void setZ(double z)
public abstract void setSizeX(double value)
public abstract void setSizeY(double value)
public abstract void setSizeZ(double value)
public double getMinX()
public double getMinY()
public double getMinZ()
public double getMaxX()
public double getMaxY()
public double getMaxZ()
public double getCenterX()
public double getCenterY()
public double getCenterZ()
public boolean isEmpty()
Rectangle5D
is empty.true
if the Rectangle5D
is empty; false
otherwise.public boolean isInfiniteX()
true
if the X dimension should be considered as infinite.public boolean isInfiniteY()
true
if the Y dimension should be considered as infinite.public boolean isInfiniteZ()
true
if the Z dimension should be considered as infinite.public void setInfiniteX()
public void setInfiniteY()
public void setInfiniteZ()
public Rectangle3D getBounds()
Shape3D
Shape3D
.
Note that there is no guarantee that the returned Rectangle3D
is the smallest bounding box that encloses
the Shape3D
, only that the Shape3D
lies entirely within the indicated
Rectangle3D
.public boolean contains(double x, double y, double z)
Rectangle3D
.public boolean contains(Point3D p)
Shape3D
Point3D
is inside the boundary
of the Shape3D
.public boolean contains(double x, double y, double z, double sizeX, double sizeY, double sizeZ)
Rectangle3D
entirely contains the specified 3D rectangular area.
All coordinates that lie inside the 3D rectangular area must lie within the Rectangle3D
.contains
in interface Shape3D
x
- the X coordinate of the minimum corner position of the specified rectangular areay
- the Y coordinate of the minimum corner position of the specified rectangular areaz
- the Z coordinate of the minimum corner position of the specified rectangular areasizeX
- size for X dimension of the specified rectangular areasizeY
- size for Y dimension of the specified rectangular areasizeZ
- size for Z dimension of the specified rectangular areatrue
if the Rectangle3D
entirely contains the
specified 3D rectangular area; false
otherwiseintersects(icy.type.geom.Line3D, icy.type.rectangle.Rectangle3D)
public boolean contains(Rectangle3D rect)
Rectangle3D
entirely contains the specified Rectangle3D
.contains
in interface Shape3D
rect
- The specified Rectangle3D
true
if the interior of the Shape3D
entirely contains the
Rectangle3D
; false
otherwise or, if the Shape3D
contains the
Rectangle3D
and the intersects
method returns true
and the
containment calculations would be too expensive to perform.contains(double, double, double, double, double, double)
public boolean intersects(double x, double y, double z, double sizeX, double sizeY, double sizeZ)
Rectangle3D
intersects the interior of a specified
3D rectangular area.Rectangle3D
if any point
is contained in both the interior of the Rectangle3D
and the specified
rectangular area.intersects
in interface Shape3D
x
- the X coordinate of the minimum corner position of the specified rectangular areay
- the Y coordinate of the minimum corner position of the specified rectangular areaz
- the Z coordinate of the minimum corner position of the specified rectangular areasizeX
- size for X dimension of the specified rectangular areasizeY
- size for Y dimension of the specified rectangular areasizeZ
- size for Z dimension of the specified rectangular areatrue
if the interior of the Rectangle3D
and
the interior of the 3D rectangular area intersect.public boolean intersects(Rectangle3D rect)
Rectangle3D
intersects the interior of a specified
Rectangle3D
.intersects
in interface Shape3D
rect
- the specified Rectangle3D
true
if the interior of the Shape3D
and the interior of the specified
Rectangle3D
intersect, or are both highly likely to intersect and intersection calculations
would be too expensive to perform; false
otherwise.intersects(double, double, double, double, double, double)
public boolean intersectsLine(Line3D line)
Rectangle3D
.public boolean intersectsLine(Point3D pt1, Point3D pt2)
Rectangle3D
.public boolean intersectsLine(double x1, double y1, double z1, double x2, double y2, double z2)
Rectangle3D
.public void add(double newx, double newy, double newz)
Rectangle3D
. The
resulting Rectangle3D
is the smallest Rectangle3D
that contains both the original
Rectangle3D
and the
specified 3D point.
After adding a 3D point, a call to contains
with the added point as an argument does not necessarily
return true
. The contains
method does not return true
for points on the
edges of a rectangle. Therefore, if the added 3D point falls on edge of the enlarged rectangle,
contains
returns false
for that point.
newx
- the X coordinate of the new pointnewy
- the Y coordinate of the new pointnewz
- the Z coordinate of the new pointpublic void add(Point3D pt)
Point3D
object pt
to this Rectangle3D
.
The resulting Rectangle3D
is the smallest Rectangle3D
that contains
both the original Rectangle3D
and the specified Point3D
.
After adding a point, a call to contains
with the added point as an argument does not necessarily
return true
. The contains
method does not return true
for points on the
edges of a rectangle. Therefore, if the added point falls on edge of the enlarged rectangle,
contains
returns false
for that point.
pt
- the new Point3D
to add to this Rectangle3D
.public void add(Rectangle3D r)
Rectangle3D
object to this Rectangle3D
. The resulting Rectangle3D
is the union of the two Rectangle3D
objects.r
- the Rectangle3D
to add to this Rectangle3D
.public abstract java.awt.geom.Rectangle2D toRectangle2D()
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.Object clone()
clone
in class java.lang.Object
java.lang.OutOfMemoryError
- if there is not enough memory.Cloneable
public java.lang.String toString()
toString
in class java.lang.Object