Class BoundingBox


  • public final class BoundingBox
    extends java.lang.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 Summary

      Constructors 
      Constructor Description
      BoundingBox​(Point[] p)  
      BoundingBox​(Point p1, Point p2)
      Create a new Bounding Box with one corner at p1 and the other at p2
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      Point center()
      Return the center of the box
      boolean contains​(BoundingBox b)
      Returns true if this contains the specified bounding box.
      void expand​(Point p)
      Expand a box to include the specified point
      double getDepth()
      Return the depth of this box
      double getHeight()
      Return the height of this box
      double getMaxX()
      Return the hightest X value of this box
      double getMaxY()
      Return the hightest Y value of this box
      double getMaxZ()
      Return the hightest Z value of this box
      double getMinX()
      Return the lowest X value of this box
      double getMinY()
      Return the lowest Y value of this box
      double getMinZ()
      Return the lowest Z value of this box
      double getWidth()
      Return the width of this box
      BoundingBox intersection​(BoundingBox b)
      Return a new bounding box that is the intersection of this and the specified box.
      BoundingBox superset​(BoundingBox b)
      Return the smallest bounding box that contains this box and the box passed as a parameter.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • 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
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object