Skip to content

Bounding Box2D

Class full path: NemAll_Python_Geometry.BoundingBox2D

2D boundingBox Representation class for 2D bounding box.

Attributes

Angle: Angle property

Get and set the angle property

Max: Point2D property

Get and set the max point property

Min: Point2D property

Get and set the min point property

Functions

Deflate overload

Deflate(x, y)

Deflate in x and y axis

Parameters:

Name Type Description Default
x float

deflate in X axis

required
y float

deflate in Y axis

required
Deflate(size)

Deflate in x,y axis concurrently.

Parameters:

Name Type Description Default
size float

deflate in x and y axis concurrently.

required

Get()

Get minimum point, maximum point and angle

Returns:

Type Description
Point2D

minimum point in local coordinate system,

Point2D

maximum point in local coordinate system,

Angle

direction of X axis of new coordinate system

GetAngle()

Get direction of X axis of new coordinate system

Returns:

Type Description
Angle

angle direction of X axis of new coordinate system

GetBoxPoint(arg2)

Get world point of a dedicated location of the box

Returns:

Type Description
Point2D

Point2D

GetCenter()

Get box center point in local coordinate system

Returns:

Type Description
Point2D

center point in local coordinates system

GetCenterPoint()

Get world point at center of box

Returns:

Type Description
Point2D

Point2D

GetHeight()

Get height of box in local system

Returns:

Type Description
float

double

GetMax()

Get maximum point in local coordinate system

Returns:

Type Description
Point2D

maximum point in local coordinate system

GetMaxPoint()

Get world point at maximum of box

Returns:

Type Description
Point2D

Point2D

GetMin()

Get minimum point in local coordinate system

Returns:

Type Description
Point2D

minimum point

GetMinPoint()

Get world point at maximum of box

Returns:

Type Description
Point2D

Point2D

GetWidth()

Get width of box in local system

Returns:

Type Description
float

double

Inflate overload

Inflate(x, y)

Inflate in x and y axis

Parameters:

Name Type Description Default
x float

inflate in X axis

required
y float

inflate in Y axis

required
Inflate(size)

Inflate in x,y axis concurrently.

Parameters:

Name Type Description Default
size float

inflate in x and y axis concurrently.

required

IsContaining overload

IsContaining(point)

Is point inside this box

Parameters:

Name Type Description Default
point Point2D

point in world coordinate system

required

Returns:

Type Description
bool

true, if is inside, otherwise false

IsContaining(box)

Is box inside this box

Parameters:

Name Type Description Default
box BoundingBox2D

bounding box

required

Returns:

Type Description
bool

true, if is inside, otherwise false

IsContaining(minmax)

Is minmax box inside this box

Parameters:

Name Type Description Default
minmax MinMax2D

minmax box

required

Returns:

Type Description
bool

true, if is inside, otherwise false

IsValid()

Test if box is valid

Returns:

Type Description
bool

true, if box valid, otherwise false

Overlaps overload

Overlaps(box)

Does box overlap this box

Parameters:

Name Type Description Default
box BoundingBox2D

bounding box

required

Returns:

Type Description
bool

true, if boxes overlap, otherwise false

Overlaps(minmax)

Does minmax box overlap this box

Parameters:

Name Type Description Default
minmax MinMax2D

MinMax2D box

required

Returns:

Type Description
bool

true, if boxes overlap, otherwise false

Reset(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:

Name Type Description Default
angle Angle

Initial angle

required

Set(min, max, angle)

Set minimum point, maximum point and angle

Parameters:

Name Type Description Default
min Point2D

minimum point in local coordinate system

required
max Point2D

maximum point in local coordinate system

required
angle Angle

angle between world X and local X coordinate system

required

SetAngle(angle)

Set direction of X axis of new coordinate system

Parameters:

Name Type Description Default
angle Angle

direction of X axis of new coordinate system

required

SetHeight(height)

Set height of box in local system. Computed from Min point

Parameters:

Name Type Description Default
height float

Height

required

SetMax(max)

Set maximum point in local coordinate system

Parameters:

Name Type Description Default
max Point2D

maximum point

required

SetMin(min)

Set minimum point

Parameters:

Name Type Description Default
min Point2D

minimum point in local coordinate system

required

SetWidth(width)

Set width of box in local system. Computed from Min point

Parameters:

Name Type Description Default
width float

Width

required

__add__ overload

__add__(boundingBox)

Expand BoundingBox2D box.

Expands the BoundingBox2D box by the box given in parameter minmax

Parameters:

Name Type Description Default
boundingBox BoundingBox2D

BoundingBox2D to be added

required

Returns:

Type Description
object

BoundingBox2D box.

__add__(minMax)

Expand BoundingBox2D box by given MinMax2D.

Expands the BoundingBox2D box by the minmax box given in parameter minmax

Parameters:

Name Type Description Default
minMax MinMax2D

MinMax2D to be added

required

Returns:

Type Description
object

BoundingBox2D box.

__eq__(boundingBox)

Comparison of boundingBoxs without tolerance.

Be careful, this method work without tolerance!

Parameters:

Name Type Description Default
boundingBox BoundingBox2D

Compared boundingBox.

required

Returns:

Type Description
object

True when boundingBoxs are equal, otherwise false.

__getitem__(index)

Get the corners of bounding box.

This method is checked and throwing Geometry::Exception when index is out of range.

Parameters:

Name Type Description Default
index int

corner index (0-left bottom, 1-right bottom, 2-right top, 3-left top)

required

Returns:

Type Description
Point2D

corner as Point2D in world coordinate system.

__iadd__ overload

__iadd__(boundingBox)

Expand BoundingBox2D box.

Expands the BoundingBox2D box by the box given in parameter minmax

Parameters:

Name Type Description Default
boundingBox BoundingBox2D

BoundingBox2D to be added

required

Returns:

Type Description
object

reference to BoundingBox2D box.

__iadd__(minmax)

Expand BoundingBox2D box by given MinMax2D.

Expands the BoundingBox2D box by the minmax box given in parameter minmax

Parameters:

Name Type Description Default
minmax MinMax2D

MinMax2D to be added

required

Returns:

Type Description
object

reference to BoundingBox2D.

__iadd__(point)

Expand BoundingBox2D box.

Expands the BoundingBox2D box by the Point2D given in parameter point

Parameters:

Name Type Description Default
point Point2D

Point2D to be added in world coordinate system

required

Returns:

Type Description
object

reference to bounding box.

__init__ overload

__init__()

initialize

__init__(angle)

Default constructor.

min point is initialized to [DBL_MAX,DBL_MAX], max point to [-DBL_MAX,-DBL_MAX],

Parameters:

Name Type Description Default
angle Angle

Angle of new initialized bounding box.

required
__init__(min, max, angle)

Set constructor

Initialize bounding box with given MIN, MAX points and slew of local coordinate system.

Parameters:

Name Type Description Default
min Point2D

minimum point in local coordinate system

required
max Point2D

maximum point in local coordinate system

required
angle Angle

direction of X axis of local coordinate system

required
__init__(boundingBox2D)

Copy constructor.

Parameters:

Name Type Description Default
boundingBox2D BoundingBox2D

BoundingBox2D to be copied

required
__init__(minMax2D)

Copy constructor.

Parameters:

Name Type Description Default
minMax2D MinMax2D

MinMax2D to be copied

required

__repr__()

convert the list to a string