Package com.luciad.geometries
Class Bounds
java.lang.Object
com.luciad.geometries.Geometry
com.luciad.geometries.Bounds
- All Implemented Interfaces:
AutoCloseable
Represents a bounds.
- See Also:
-
Constructor Summary
ConstructorDescriptionBounds
(CoordinateReference reference, Coordinate location, double width, double height, double depth) Creates a new bounds instance based on a point, and the width, height and depth with respect to that point.Bounds
(CoordinateReference reference, Coordinate lowerLeft, Coordinate upperRight) Creates a new bounds instance based on lower left and upper right corners. -
Method Summary
Modifier and TypeMethodDescriptionstatic Bounds
boundsUnion
(Bounds bounds1, Bounds bounds2) Returns the union of the two bounds objects, provided they are defined in the same coordinate reference.void
close()
static boolean
contains2D
(Bounds bounds, Coordinate coordinate) Checks if this bounds contains the specified coordinate, considering only the x and y values.static boolean
contains2D
(Bounds bounds, Coordinate coordinate, double eps) Checks if this bounds contains the specified coordinate, considering only the x and y values.static boolean
contains2D
(Bounds bounds1, Bounds bounds2) Checks if the first bounds contains the second bounds, only considering x and y values.static boolean
contains2D
(Bounds bounds1, Bounds bounds2, double eps) Checks if the first bounds contains the second bounds, only considering x and y values.static boolean
contains3D
(Bounds bounds, Coordinate coordinate) Checks if the first bounds contains the second bounds.static boolean
contains3D
(Bounds bounds, Coordinate coordinate, double eps) Checks if the first bounds contains the second bounds.boolean
protected void
finalize()
Returns the center of this bounds instance.double
getDepth()
Returns the depth of this bounds instance.double
Returns the height of this bounds instance.Returns the lower left corner of this bounds instance.Returns the lower left corner of this bounds instance.Returns the lower right corner of this bounds instance.Returns the upper left corner of this bounds instance.Returns the upper right corner of this bounds instance.double
getWidth()
Returns the width of this bounds instance.int
hashCode()
static boolean
interacts2D
(Bounds bounds1, Bounds bounds2) Checks of two given bounds geometries have an interaction, only considering x and y values.static boolean
interacts2D
(Bounds bounds1, Bounds bounds2, double eps) Checks of two given bounds geometries have an interaction, only considering x and y values.static Bounds
intersection2D
(Bounds bounds1, Bounds bounds2) Returns the intersection of the two given bounds geometries.Methods inherited from class com.luciad.geometries.Geometry
getBounds, getReference
-
Constructor Details
-
Bounds
-
Bounds
public Bounds(@NotNull CoordinateReference reference, @NotNull Coordinate location, double width, double height, double depth) Creates a new bounds instance based on a point, and the width, height and depth with respect to that point.- Parameters:
reference
- the coordinate referencelocation
- the lower left location of the boundswidth
- the widthheight
- the heightdepth
- the depth
-
Bounds
public Bounds(@NotNull CoordinateReference reference, @NotNull Coordinate lowerLeft, @NotNull Coordinate upperRight) Creates a new bounds instance based on lower left and upper right corners.This method takes wrap-around the 180° meridian into account when the coordinate reference is geodetic.
- Parameters:
reference
- the coordinate referencelowerLeft
- the lower left corner of the boundsupperRight
- the upper right corner of the bounds
-
-
Method Details
-
finalize
protected void finalize() -
close
public void close()- Specified by:
close
in interfaceAutoCloseable
- Overrides:
close
in classGeometry
-
getLocation
Returns the lower left corner of this bounds instance.- Returns:
- the lower left corner of this bounds instance.
-
getWidth
public double getWidth()Returns the width of this bounds instance.- Returns:
- the width of this bounds instance.
-
getHeight
public double getHeight()Returns the height of this bounds instance.- Returns:
- the height of this bounds instance.
-
getDepth
public double getDepth()Returns the depth of this bounds instance.- Returns:
- the depth of this bounds instance.
-
getCenter
Returns the center of this bounds instance.When this bounds uses a geodetic reference, this method normalizes the result.
- Returns:
- the center of this bounds instance.
-
getLowerLeftCorner
Returns the lower left corner of this bounds instance.When this bounds uses a geodetic reference, this method normalizes the result.
- Returns:
- the lower left corner of this bounds instance.
-
getLowerRightCorner
Returns the lower right corner of this bounds instance.When this bounds uses a geodetic reference, this method normalizes the result.
- Returns:
- the lower right corner of this bounds instance.
-
getUpperLeftCorner
Returns the upper left corner of this bounds instance.When this bounds uses a geodetic reference, this method normalizes the result.
- Returns:
- the upper left corner of this bounds instance.
-
getUpperRightCorner
Returns the upper right corner of this bounds instance.When this bounds uses a geodetic reference, this method normalizes the result.
- Returns:
- the upper right corner of this bounds instance.
-
boundsUnion
@NotNull public static Bounds boundsUnion(@NotNull Bounds bounds1, @NotNull Bounds bounds2) throws IllegalArgumentException Returns the union of the two bounds objects, provided they are defined in the same coordinate reference.- Parameters:
bounds1
- the first bounds.bounds2
- the second bounds.- Returns:
- the union of the two bounds objects.
- Throws:
IllegalArgumentException
- if the bounds are not defined in the same coordinate reference.
-
intersection2D
Returns the intersection of the two given bounds geometries.- Parameters:
bounds1
- a bounds instancebounds2
- an other bounds instance- Returns:
- the intersection of the given bounds geometries. If geodetic bounds, the result is normalized.
-
interacts2D
public static boolean interacts2D(@NotNull Bounds bounds1, @NotNull Bounds bounds2, double eps) throws IllegalArgumentException Checks of two given bounds geometries have an interaction, only considering x and y values.- Parameters:
bounds1
- the first bounds.bounds2
- the second bounds.eps
- a tolerance for the interaction check.- Returns:
- true if the two bounds interact in 2D.
- Throws:
IllegalArgumentException
- if the bounds are not defined in the same coordinate reference.
-
interacts2D
public static boolean interacts2D(@NotNull Bounds bounds1, @NotNull Bounds bounds2) throws IllegalArgumentException Checks of two given bounds geometries have an interaction, only considering x and y values.- Parameters:
bounds1
- the first bounds.bounds2
- the second bounds.- Returns:
- true if the two bounds interact in 2D.
- Throws:
IllegalArgumentException
- if the bounds are not defined in the same coordinate reference.
-
contains2D
public static boolean contains2D(@NotNull Bounds bounds, @NotNull Coordinate coordinate, double eps) Checks if this bounds contains the specified coordinate, considering only the x and y values.- Returns:
- true if this bounds contains the specified coordinate, considering only the x and y values.
-
contains2D
Checks if this bounds contains the specified coordinate, considering only the x and y values.- Returns:
- true if this bounds contains the specified coordinate, considering only the x and y values.
-
contains2D
public static boolean contains2D(@NotNull Bounds bounds1, @NotNull Bounds bounds2, double eps) throws IllegalArgumentException Checks if the first bounds contains the second bounds, only considering x and y values.- Parameters:
bounds1
- a bounds instance.bounds2
- an other bounds instance.eps
- a tolerance for the contains check.- Returns:
- if the first bounds contains the second bounds.
- Throws:
IllegalArgumentException
- if the bounds are not defined in the same coordinate reference.
-
contains2D
public static boolean contains2D(@NotNull Bounds bounds1, @NotNull Bounds bounds2) throws IllegalArgumentException Checks if the first bounds contains the second bounds, only considering x and y values.- Parameters:
bounds1
- a bounds instance.bounds2
- an other bounds instance.- Returns:
- if the first bounds contains the second bounds.
- Throws:
IllegalArgumentException
- if the bounds are not defined in the same coordinate reference.
-
contains3D
public static boolean contains3D(@NotNull Bounds bounds, @NotNull Coordinate coordinate, double eps) Checks if the first bounds contains the second bounds.- Parameters:
bounds
- a bounds instance.coordinate
- a coordinate.eps
- a tolerance for the contains check.- Returns:
- true if this bounds contains the specified coordinate.
-
contains3D
Checks if the first bounds contains the second bounds.- Parameters:
bounds
- a bounds instance.coordinate
- a coordinate.- Returns:
- true if this bounds contains the specified coordinate.
-
hashCode
public int hashCode() -
equals
-