BoundingBox2D
Canonical path: NemAll_Python_Geometry.BoundingBox2D
Representation class for 2D bounding box.
Bounding box work correct only if m_Min <= m_Max. It means that X coordinate of m_Min is less then or equal to X coordinate of m_Max(m_Min.X() <= m_Max.X()) and Y coordinate of m_Min is less than or equal to Y coordinate of m_Max(m_Min.Y() <= m_Max.Y()).
Deflate
overloaded
Deflate in x and y axis
Parameters:
-
x
(float
) –deflate in X axis
-
y
(float
) –deflate in Y axis
Deflate in x,y axis concurrently.
Parameters:
-
size
(float
) –deflate in x and y axis concurrently.
Get
GetAngle
GetAngle() -> Angle
Get direction of X axis of new coordinate system
Returns:
-
Angle
–angle direction of X axis of new coordinate system
GetBoxPoint
GetCenter
GetCenter() -> Point2D
Get box center point in local coordinate system
Returns:
-
Point2D
–center point in local coordinates system
GetCenterPoint
GetCenterPoint() -> Point2D
GetMax
GetMax() -> Point2D
Get maximum point in local coordinate system
Returns:
-
Point2D
–maximum point in local coordinate system
GetMin
GetMin() -> Point2D
Inflate
overloaded
Inflate in x and y axis
Parameters:
-
x
(float
) –inflate in X axis
-
y
(float
) –inflate in Y axis
Inflate in x,y axis concurrently.
Parameters:
-
size
(float
) –inflate in x and y axis concurrently.
IsContaining
overloaded
IsContaining(point: Point2D) -> bool
Is point inside this box
Parameters:
-
point
(Point2D
) –point in world coordinate system
Returns:
-
bool
–true, if is inside, otherwise false
IsContaining(box: BoundingBox2D) -> bool
Is box inside this box
Parameters:
-
box
(BoundingBox2D
) –bounding box
Returns:
-
bool
–true, if is inside, otherwise false
IsContaining(minmax: MinMax2D) -> bool
Is minmax box inside this box
Parameters:
-
minmax
(MinMax2D
) –minmax box
Returns:
-
bool
–true, if is inside, otherwise false
Overlaps
overloaded
Overlaps(box: BoundingBox2D) -> bool
Does box overlap this box
Parameters:
-
box
(BoundingBox2D
) –bounding box
Returns:
-
bool
–true, if boxes overlap, otherwise false
Overlaps(minmax: MinMax2D) -> bool
Does minmax box overlap this box
Parameters:
-
minmax
(MinMax2D
) –MinMax2D box
Returns:
-
bool
–true, if boxes overlap, otherwise false
Reset
Reset(angle: Angle)
Reset bounding box and set initial angle
When bounding box is reseted, then min point is initialized to [DBL_MAX,DBL_MAX], max point to [-DBL_MAX,-DBL_MAX],
This method is using when previous initialized bounding box start accept a new point values.
Parameters:
-
angle
(Angle
) –Initial angle
Set
SetAngle
SetAngle(angle: Angle)
Set direction of X axis of new coordinate system
Parameters:
-
angle
(Angle
) –direction of X axis of new coordinate system
SetHeight
Set height of box in local system. Computed from Min point
Parameters:
-
height
(float
) –Height
SetMax
SetMax(max: Point2D)
SetMin
SetMin(min: Point2D)
SetWidth
Set width of box in local system. Computed from Min point
Parameters:
-
width
(float
) –Width
__add__
overloaded
__add__(boundingBox: BoundingBox2D) -> BoundingBox2D
Expand BoundingBox2D box.
Expands the BoundingBox2D box by the box given in parameter minmax
Parameters:
-
boundingBox
(BoundingBox2D
) –BoundingBox2D to be added
Returns:
-
BoundingBox2D
–BoundingBox2D box.
__add__(minMax: MinMax2D) -> BoundingBox2D
Expand BoundingBox2D box by given MinMax2D.
Expands the BoundingBox2D box by the minmax box given in parameter minmax
Parameters:
-
minMax
(MinMax2D
) –MinMax2D to be added
Returns:
-
BoundingBox2D
–BoundingBox2D box.
__eq__
__eq__(bounding_box: BoundingBox2D) -> bool
Comparison of bounding boxes.
Be careful, this method work without tolerance!
Parameters:
-
bounding_box
(BoundingBox2D
) –bounding box to be compared.
Returns:
-
bool
–True when bounding boxes are equal, otherwise false.
__getitem__
__getitem__(index: int) -> Point2D
Get the corners of bounding box.
This method is checked and throwing Geometry::Exception when index is out of range.
Parameters:
-
index
(int
) –corner index (0-left bottom, 1-right bottom, 2-right top, 3-left top)
Returns:
-
Point2D
–corner as Point2D in world coordinate system.
__iadd__
overloaded
__iadd__(boundingBox: BoundingBox2D) -> BoundingBox2D
Expand BoundingBox2D box.
Expands the BoundingBox2D box by the box given in parameter minmax
Parameters:
-
boundingBox
(BoundingBox2D
) –BoundingBox2D to be added
Returns:
-
BoundingBox2D
–BoundingBox2D box.
__iadd__(minmax: MinMax2D) -> BoundingBox2D
Expand BoundingBox2D box by given MinMax2D.
Expands the BoundingBox2D box by the minmax box given in parameter minmax
Parameters:
-
minmax
(MinMax2D
) –MinMax2D to be added
Returns:
-
BoundingBox2D
–BoundingBox2D.
__iadd__(point: Point2D) -> BoundingBox2D
Expand BoundingBox2D box.
Expands the BoundingBox2D box by the Point2D given in parameter point
Parameters:
-
point
(Point2D
) –Point2D to be added in world coordinate system
Returns:
-
BoundingBox2D
–bounding box.
__init__
overloaded
Initialize
__init__(angle: Angle)
Default constructor.
min point is initialized to [DBL_MAX,DBL_MAX], max point to [-DBL_MAX,-DBL_MAX],
Parameters:
-
angle
(Angle
) –Angle of new initialized bounding box.
__init__(boundingBox2D: BoundingBox2D)
__init__(minMax2D: MinMax2D)