Class BoundingBox2D

java.lang.Object
org.episteme.core.mathematics.geometry.boundaries.BoundingBox2D
All Implemented Interfaces:
Serializable, BoundingBox<Point2D>

public class BoundingBox2D extends Object implements BoundingBox<Point2D>
Axis-aligned bounding box in 2D.
Since:
1.0
Author:
Silvere Martin-Michiellot, Gemini AI (Google DeepMind)
See Also:
  • Constructor Details

    • BoundingBox2D

      public BoundingBox2D(Point2D min, Point2D max)
      Creates a bounding box from min and max corners.
      Parameters:
      min - the minimum corner (lower-left)
      max - the maximum corner (upper-right)
    • BoundingBox2D

      public BoundingBox2D(Real minX, Real minY, Real maxX, Real maxY)
      Creates a bounding box from coordinate values.
  • Method Details

    • fromPoints

      public static BoundingBox2D fromPoints(List<Point2D> points)
      Creates a bounding box enclosing all points.
      Parameters:
      points - the points to enclose
      Returns:
      the bounding box
    • getMin

      public Point2D getMin()
      Description copied from interface: BoundingBox
      Returns the minimum corner of the bounding box.
      Specified by:
      getMin in interface BoundingBox<Point2D>
      Returns:
      the min point
    • getMax

      public Point2D getMax()
      Description copied from interface: BoundingBox
      Returns the maximum corner of the bounding box.
      Specified by:
      getMax in interface BoundingBox<Point2D>
      Returns:
      the max point
    • getWidth

      public Real getWidth()
      Returns the width (x extent).
      Returns:
      width
    • getHeight

      public Real getHeight()
      Returns the height (y extent).
      Returns:
      height
    • getCenter

      public Point2D getCenter()
      Returns the center point.
      Returns:
      center
    • getArea

      public Real getArea()
      Returns the area.
      Returns:
      area
    • contains

      public boolean contains(Point2D point)
      Description copied from interface: BoundingBox
      Checks if a point is within this bounding box.
      Specified by:
      contains in interface BoundingBox<Point2D>
      Parameters:
      point - the point to check
      Returns:
      true if contained
    • intersects

      public boolean intersects(BoundingBox<Point2D> other)
      Description copied from interface: BoundingBox
      Checks if this box intersects with another.
      Specified by:
      intersects in interface BoundingBox<Point2D>
      Parameters:
      other - the other bounding box
      Returns:
      true if boxes overlap
    • include

      public BoundingBox<Point2D> include(Point2D point)
      Description copied from interface: BoundingBox
      Expands this bounding box to include a point.
      Specified by:
      include in interface BoundingBox<Point2D>
      Parameters:
      point - the point to include
      Returns:
      expanded bounding box
    • merge

      public BoundingBox<Point2D> merge(BoundingBox<Point2D> other)
      Description copied from interface: BoundingBox
      Merges this bounding box with another.
      Specified by:
      merge in interface BoundingBox<Point2D>
      Parameters:
      other - the other box
      Returns:
      merged bounding box
    • toString

      public String toString()
      Overrides:
      toString in class Object