Class Boxes


  • public abstract class Boxes
    extends java.lang.Object
    A collection of utilities to assist with boxes manipulation.
    Author:
    Dimitrios Michail
    • Constructor Detail

      • Boxes

        public Boxes()
    • Method Detail

      • containsPoint

        public static boolean containsPoint​(Box2D box,
                                            Point2D p)
        Test whether a box contains a point.
        Parameters:
        box - the box
        p - the point
        Returns:
        true if the point is contained inside the box, false otherwise
      • splitAlongXAxis

        public static Pair<Box2D,​Box2D> splitAlongXAxis​(Box2D box)
        Split a box along the x axis into two equal boxes.
        Parameters:
        box - the box to split
        Returns:
        a pair with the two resulting boxes
      • splitAlongYAxis

        public static Pair<Box2D,​Box2D> splitAlongYAxis​(Box2D box)
        Split a box along the y axis into two equal boxes.
        Parameters:
        box - the box to split
        Returns:
        a pair with the two resulting boxes
      • containsPoint

        public static boolean containsPoint​(Box2D box,
                                            Point2D p,
                                            java.util.Comparator<java.lang.Double> comparator)
        Test whether a box contains a point.
        Parameters:
        box - the box
        p - the point
        comparator - the comparator to use
        Returns:
        true if the point is contained inside the box, false otherwise