Interface Bounds2d

All Known Subinterfaces:
BVH<V>, VectorGeometry
All Known Implementing Classes:
AbstractLine, AbstractPolygon, AbstractVectorGeometry, CornerBoundingBox2d, DistancePolygon, FillPolygon, NarrowLine, Segment, SharpLine, WideLine

public interface Bounds2d
An axis-aligned, 2D bounding box using double-precision floating-point coordinates.
  • Method Summary

    Modifier and Type
    Method
    Description
    default boolean
    contains(@NonNull Bounds2d other)
    Checks whether or not this bounding box contains the given bounding box.
    default Bounds2d
    expand(double offset)
    Expands this bounding box by the given amount in every direction.
    default boolean
    intersects(@NonNull Bounds2d other)
    Checks whether or not this bounding box intersects the given bounding box.
    double
     
    double
     
    double
     
    double
     
    static Bounds2d
    of(double x0, double x1, double z0, double z1)
     
    toCornerBB(@NonNull GeographicProjection proj, boolean geo)
    Converts this bounding box to an equivalent CornerBoundingBox2d.
    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 Bounds2d
    union(@NonNull Bounds2d other)
    Returns a bounding box that contains this bounding box and the given one.
    default Bounds2d
    validate(@NonNull GeographicProjection proj, boolean geo)
    Ensures that this bounding box is entirely within valid projection bounds.
  • Method Details

    • of

      static Bounds2d of(double x0, double x1, double z0, double z1)
    • 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

      default boolean intersects(@NonNull @NonNull Bounds2d other)
      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

      default boolean contains(@NonNull @NonNull Bounds2d other)
      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

      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.
      Parameters:
      size - the side length of a tile
      Returns:
      the positions of every tile that intersects this bounding box
    • union

      default Bounds2d union(@NonNull @NonNull Bounds2d other)
      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

      default Bounds2d expand(double offset)
      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 equivalent CornerBoundingBox2d.
      Parameters:
      proj - the GeographicProjection to use
      geo - whether or not this bounding box uses geographic coordinates
      Returns:
      a CornerBoundingBox2d equivalent 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 - the GeographicProjection to use
      geo - whether or not this bounding box uses geographic coordinates
      Throws:
      OutOfProjectionBoundsException - if any part of this bounding box is out of valid projection bounds