public class BoundBox extends Object
| 构造器和说明 |
|---|
BoundBox(int left,
int right,
int top,
int bottom)
Create a bounding box
|
| 限定符和类型 | 方法和说明 |
|---|---|
boolean |
contains(int x,
int y)
Check if a point is in the box
|
boolean |
equals(Object obj) |
int |
getArea() |
int |
getBottom() |
int |
getHeight() |
int |
getLeft() |
int |
getRight() |
int |
getTop() |
int |
getWidth() |
int |
hashCode() |
static BoundBox |
intersect(BoundBox a,
BoundBox b)
Get the intersection of two bounding boxes
|
BoundBox |
scale(double factor)
Zoom this box
|
String |
toString() |
static BoundBox |
union(BoundBox a,
BoundBox b)
Get the smallest box that contains two bounding boxes
|
static BoundBox |
union(Iterator<BoundBox> box)
Get the smallest box that contains all given bounding boxes
|
public BoundBox(int left,
int right,
int top,
int bottom)
left - min Xright - max Xtop - min Ybottom - max Ypublic int getLeft()
public int getRight()
public int getTop()
public int getBottom()
public int getWidth()
public int getHeight()
public int getArea()
public boolean contains(int x,
int y)
x - x coordinatey - y coordinatepublic BoundBox scale(double factor)
factor - the scalepublic static BoundBox intersect(BoundBox a, BoundBox b)
a - a bounding boxb - another bounding boxpublic static BoundBox union(BoundBox a, BoundBox b)
a - a bounding boxb - another bounding boxpublic static BoundBox union(Iterator<BoundBox> box)
box - given bounding boxesCopyright © 2019. All rights reserved.