类 BoundBox


  • public class BoundBox
    extends Object
    Bounding box
    作者:
    Chan Chung Kwong
    • 构造器详细资料

      • BoundBox

        public BoundBox​(int left,
                        int right,
                        int top,
                        int bottom)
        Create a bounding box
        参数:
        left - min X
        right - max X
        top - min Y
        bottom - max Y
    • 方法详细资料

      • getLeft

        public int getLeft()
        返回:
        min X
      • getRight

        public int getRight()
        返回:
        max X
      • getTop

        public int getTop()
        返回:
        min Y
      • getBottom

        public int getBottom()
        返回:
        max Y
      • getWidth

        public int getWidth()
        返回:
        width
      • getHeight

        public int getHeight()
        返回:
        height
      • getArea

        public int getArea()
        返回:
        area
      • contains

        public boolean contains​(int x,
                                int y)
        Check if a point is in the box
        参数:
        x - x coordinate
        y - y coordinate
        返回:
      • scale

        public BoundBox scale​(double factor)
        Zoom this box
        参数:
        factor - the scale
        返回:
        new bounding box
      • intersect

        public static BoundBox intersect​(BoundBox a,
                                         BoundBox b)
        Get the intersection of two bounding boxes
        参数:
        a - a bounding box
        b - another bounding box
        返回:
        intersection
      • union

        public static BoundBox union​(BoundBox a,
                                     BoundBox b)
        Get the smallest box that contains two bounding boxes
        参数:
        a - a bounding box
        b - another bounding box
        返回:
        the smallest box that contains them
      • union

        public static BoundBox union​(Iterator<BoundBox> box)
        Get the smallest box that contains all given bounding boxes
        参数:
        box - given bounding boxes
        返回:
        the smallest box that contains them
      • hashCode

        public int hashCode()
        覆盖:
        hashCode 在类中 Object