Class BoundingBox


  • public final class BoundingBox
    extends Object

    A BoundingBox is a simple cube which is used to define the "Bounding Box", or the smallest cube that contains a object, on a Canvas.

    This class is used internally by the library and is of no interest to end users

    • Constructor Detail

      • BoundingBox

        public BoundingBox​(Point p1,
                           Point p2)
        Create a new Bounding Box with one corner at p1 and the other at p2
        Parameters:
        p1 - The first corner of the box
        p2 - The opposite corner of the box
      • BoundingBox

        public BoundingBox​(Point[] p)
    • Method Detail

      • expand

        public void expand​(Point p)
        Expand a box to include the specified point
      • contains

        public boolean contains​(BoundingBox b)
        Returns true if this contains the specified bounding box.
      • superset

        public BoundingBox superset​(BoundingBox b)
        Return the smallest bounding box that contains this box and the box passed as a parameter.
      • intersection

        public BoundingBox intersection​(BoundingBox b)
        Return a new bounding box that is the intersection of this and the specified box. Returns null if no intersection exists
      • center

        public Point center()
        Return the center of the box
      • getMinX

        public double getMinX()
        Return the lowest X value of this box
      • getMinY

        public double getMinY()
        Return the lowest Y value of this box
      • getMinZ

        public double getMinZ()
        Return the lowest Z value of this box
      • getMaxX

        public double getMaxX()
        Return the hightest X value of this box
      • getMaxY

        public double getMaxY()
        Return the hightest Y value of this box
      • getMaxZ

        public double getMaxZ()
        Return the hightest Z value of this box
      • getWidth

        public double getWidth()
        Return the width of this box
      • getHeight

        public double getHeight()
        Return the height of this box
      • getDepth

        public double getDepth()
        Return the depth of this box