public interface ILcdBounds extends ILcdShape
ILcdBounds
object is an ILcdShape
representing a 3D axis-aligned box.
It has a location
, which is an ILcdPoint.
It also has a width
, a height
, and a depth
,
which are the extents in the positive directions of the x, y and z-axis,
respectively. The box is typically used as a bounding box for more
complex geometries.
You can use the convenience functions getMinX()
, getMaxX()
, getMinY()
, getMaxY()
, getMinZ()
, getMaxZ()
.
These are derived properties, calculated from the location and width/height/depth.
A bounds object can be undefined
, which means it does not describe a valid geographic region.
Note that this interface only provides read methods, and no write
methods. This way, efficient read-only implementations can be made,
and methods can have read-only parameters and return values, reducing
the risk of erroneous side-effects. Writable copies can be constructed
using cloneAs2DEditableBounds()
and cloneAs3DEditableBounds
.
ILcd2DEditableBounds
,
ILcd3DEditableBounds
Modifier and Type | Method and Description |
---|---|
ILcd2DEditableBounds |
cloneAs2DEditableBounds()
Returns a copy of this
ILcdBounds object that is also an ILcd2DEditableBounds . |
ILcd3DEditableBounds |
cloneAs3DEditableBounds()
Returns a copy of this
ILcdBounds object that is also an ILcd3DEditableBounds . |
boolean |
contains2D(double aX,
double aY,
double aWidth,
double aHeight)
Checks whether this
ILcdBounds object contains the given rectangle in
the 2D space. |
boolean |
contains2D(ILcdBounds aBounds)
Checks whether this
ILcdBounds object contains the given ILcdBounds
object in the 2D space. |
boolean |
contains3D(double aX,
double aY,
double aZ,
double aWidth,
double aHeight,
double aDepth)
Checks whether this
ILcdBounds object contains the given box in the 3D
space. |
boolean |
contains3D(ILcdBounds aBounds)
Checks whether this
ILcdBounds object contains the given ILcdBounds
object in the 3D space. |
default ILcdPoint |
getCenter()
Returns the center of the bounds.
|
double |
getDepth()
Returns the depth of the bounding box.
|
double |
getHeight()
Returns the height of the bounding box.
|
ILcdPoint |
getLocation()
Returns the location of the bounding box (smallest x and y coordinates).
|
default double |
getMaxX()
Returns the maximum X value (right boundary) of this bounds.
|
default double |
getMaxY()
Returns the maximum Y value (upper boundary) of this bounds.
|
default double |
getMaxZ()
Returns the maximum Z value (top boundary) of this bounds.
|
default double |
getMinX()
Returns the minimum X value (left boundary) of this bounds.
|
default double |
getMinY()
Returns the minimum Y value (lower boundary) of this bounds.
|
default double |
getMinZ()
Returns the minimum Z value (bottom boundary) of this bounds.
|
double |
getWidth()
Returns the width of the bounding box.
|
boolean |
interacts2D(double aX,
double aY,
double aWidth,
double aHeight)
Checks whether this
ILcdBounds object interacts with the given rectangle in
the 2D space. |
boolean |
interacts2D(ILcdBounds aBounds)
Checks whether this
ILcdBounds object interacts with the given ILcdBounds
object in the 2D space. |
boolean |
interacts3D(double aX,
double aY,
double aZ,
double aWidth,
double aHeight,
double aDepth)
Checks whether this
ILcdBounds object interacts with the given box in
the 3D space. |
boolean |
interacts3D(ILcdBounds aBounds)
Checks whether this
ILcdBounds object interacts with the given ILcdBounds
object. |
boolean |
isDefined()
Indicates whether this bounds object is valid.
|
contains2D, contains2D, contains3D, contains3D, getFocusPoint
getBounds
clone
boolean isDefined()
true
, this bounds describes a valid geographic region.false
, this bounds does not represent a geographic region, and its
location, width, height and depth should not be used.true
if this object describes actual bounds, false
if notILcdPoint getLocation()
double getWidth()
double getHeight()
double getDepth()
boolean interacts2D(ILcdBounds aBounds)
ILcdBounds
object interacts with the given ILcdBounds
object in the 2D space. Only the first two dimensions of the ILcdBounds
objects
are considered.
If either bounds is undefined
, the result is false.
aBounds
- the ILcdBounds
to compare with.interacts2D(double, double, double, double)
boolean interacts2D(double aX, double aY, double aWidth, double aHeight)
ILcdBounds
object interacts with the given rectangle in
the 2D space. Only the first two dimensions of the ILcdBounds
object
are considered.
If this bounds is undefined
, the result is false.
aX
- the x coordinate of the rectangle.aY
- the y coordinate of the rectangle.aWidth
- the width of the rectangle.aHeight
- the height of the rectangle.true
if this ILcdBounds
object touches or overlaps to
any extent with the given rectangle, false
otherwise.boolean contains2D(ILcdBounds aBounds)
ILcdBounds
object contains the given ILcdBounds
object in the 2D space. Only the first two dimensions of the ILcdBounds
objects
are considered.
If either bounds is undefined
, the result is false.
aBounds
- the ILcdBounds
to compare with.contains2D(double, double, double, double)
boolean contains2D(double aX, double aY, double aWidth, double aHeight)
ILcdBounds
object contains the given rectangle in
the 2D space. Only the first two dimensions of the ILcdBounds
object
are considered.
If this bounds is undefined
, the result is false.
aX
- the x coordinate of the rectangle.aY
- the y coordinate of the rectangle.aWidth
- the width of the rectangle.aHeight
- the height of the rectangle.boolean interacts3D(ILcdBounds aBounds)
ILcdBounds
object interacts with the given ILcdBounds
object.
If either bounds is undefined
, the result is false.
aBounds
- the ILcdBounds
to compare with.interacts3D(double, double, double, double, double, double)
boolean interacts3D(double aX, double aY, double aZ, double aWidth, double aHeight, double aDepth)
ILcdBounds
object interacts with the given box in
the 3D space.
If this bounds is undefined
, the result is false.
aX
- the x coordinate of the box.aY
- the y coordinate of the box.aZ
- the z coordinate of the box.aWidth
- the width of the box.aHeight
- the height of the box.aDepth
- the depth of the box.true
if this ILcdBounds
object touches or overlaps to
any extent with the given box, false
otherwise.boolean contains3D(ILcdBounds aBounds)
ILcdBounds
object contains the given ILcdBounds
object in the 3D space.
If either bounds is undefined
, the result is false.
aBounds
- the ILcdBounds
to compare with.contains3D(double, double, double, double, double, double)
boolean contains3D(double aX, double aY, double aZ, double aWidth, double aHeight, double aDepth)
ILcdBounds
object contains the given box in the 3D
space.
If this bounds is undefined
, the result is false.
aX
- the x coordinate of the point.aY
- the y coordinate of the point.aZ
- the z coordinate of the point.aWidth
- the width of the box.aHeight
- the height of the box.aDepth
- the depth of the box.contains2D(double, double, double, double)
ILcd2DEditableBounds cloneAs2DEditableBounds()
ILcdBounds
object that is also an ILcd2DEditableBounds
.
This makes sure that the first two dimensions of the copy are writable,
even if the original ILcdBounds
object may be read-only.ILcdBounds
object that is also an ILcd2DEditableBounds
.
This makes sure that the first two dimensions of the copy are writable,
even if the original ILcdBounds
object may be read-only.ILcd2DEditableBounds
ILcd3DEditableBounds cloneAs3DEditableBounds()
ILcdBounds
object that is also an ILcd3DEditableBounds
.
This makes sure that all three dimensions of the copy are writable,
even if the original ILcdBounds
object may be read-only.ILcdBounds
object that is also an ILcd3DEditableBounds
.
This makes sure that all three dimensions of the copy are writable,
even if the original ILcdBounds
object may be read-only.ILcd3DEditableBounds
default ILcdPoint getCenter()
default double getMinX()
getLocation.getX()
, but can be overridden for performance.getMaxX()
default double getMinY()
getLocation.getY()
, but can be overridden for performance.getMaxY()
default double getMinZ()
getLocation.getZ()
, but can be overridden for performance.getMaxZ()
default double getMaxX()
getLocation.getX() + getWidth()
, but can be overridden for performance.
Note that this is a derived property, the bounds are defined by their lower-left corner and width/height.
For geodetic bounds
, the returned value is not necessarily normalized to [-180, 180].getMinX()
default double getMaxY()
getLocation.getY() + getHeight()
, but can be overridden for performance.
Note that this is a derived property, the bounds are defined by their lower-left corner and width/height.getMinY()
default double getMaxZ()
getLocation.getZ() + getDepth()
, but can be overridden for performance.
Note that this is a derived property, the bounds are defined by their lower-left corner and width/height.getMinZ()