Interface Bounds2d
- All Known Subinterfaces:
BVH<V>,VectorGeometry
- All Known Implementing Classes:
AbstractLine,AbstractPolygon,AbstractVectorGeometry,CornerBoundingBox2d,DistancePolygon,FillPolygon,NarrowLine,Segment,SharpLine,UserOverrideBiomeFilter.BiomeBoundingBox,WideLine
public interface Bounds2d
An axis-aligned, 2D bounding box using double-precision floating-point coordinates.
-
Method Summary
Modifier and TypeMethodDescriptiondefault booleanChecks whether or not this bounding box contains the given bounding box.default Bounds2dexpand(double offset) Expands this bounding box by the given amount in every direction.default booleanintersects(@NonNull Bounds2d other) Checks whether or not this bounding box intersects the given bounding box.doublemaxX()doublemaxZ()doubleminX()doubleminZ()static Bounds2dof(double x0, double x1, double z0, double z1) default CornerBoundingBox2dtoCornerBB(@NonNull GeographicProjection proj, boolean geo) Converts this bounding box to an equivalentCornerBoundingBox2d.default ChunkPos[]toTiles(double size) Assuming this bounding box is located on a grid of square tiles, gets the positions of every tile that intersects this bounding box.default Bounds2dReturns a bounding box that contains this bounding box and the given one.default Bounds2dvalidate(@NonNull GeographicProjection proj, boolean geo) Ensures that this bounding box is entirely within valid projection bounds.
-
Method Details
-
of
-
minX
double minX()- Returns:
- the minimum X coordinate
-
maxX
double maxX()- Returns:
- the maximum X coordinate
-
minZ
double minZ()- Returns:
- the minimum Z coordinate
-
maxZ
double maxZ()- Returns:
- the maximum Z coordinate
-
intersects
Checks whether or not this bounding box intersects the given bounding box.- Parameters:
other- the bounding box- Returns:
- whether or not the two bounding boxes intersect
-
contains
Checks whether or not this bounding box contains the given bounding box.- Parameters:
other- the bounding box- Returns:
- whether or not this bounding box contains the given bounding box
-
toTiles
Assuming this bounding box is located on a grid of square tiles, gets the positions of every tile that intersects this bounding box.- Parameters:
size- the side length of a tile- Returns:
- the positions of every tile that intersects this bounding box
-
union
Returns a bounding box that contains this bounding box and the given one.- Parameters:
other- the other bounding box- Returns:
- the minimum bounding box containing both bounding boxes
-
expand
Expands this bounding box by the given amount in every direction.- Parameters:
offset- the amount to expand the bounding box by- Returns:
- the expanded bounding box
-
toCornerBB
default CornerBoundingBox2d toCornerBB(@NonNull @NonNull GeographicProjection proj, boolean geo) throws OutOfProjectionBoundsException Converts this bounding box to an equivalentCornerBoundingBox2d.- Parameters:
proj- theGeographicProjectionto usegeo- whether or not this bounding box uses geographic coordinates- Returns:
- a
CornerBoundingBox2dequivalent to this bounding box - Throws:
OutOfProjectionBoundsException
-
validate
default Bounds2d validate(@NonNull @NonNull GeographicProjection proj, boolean geo) throws OutOfProjectionBoundsException Ensures that this bounding box is entirely within valid projection bounds.- Parameters:
proj- theGeographicProjectionto usegeo- whether or not this bounding box uses geographic coordinates- Throws:
OutOfProjectionBoundsException- if any part of this bounding box is out of valid projection bounds
-