Skip to content

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()).

Angle property writable

Angle: Angle

Get direction of X axis of new coordinate system

Height property writable

Height: float

Get height of box in local system

Max property writable

Max: Point2D

Get maximum point in local coordinate system

Min property writable

Min: Point2D

Get minimum point in local coordinate system

Width property writable

Width: float

Get width of box in local system

Deflate overloaded

Deflate(x: float, y: float)

Deflate in x and y axis

Parameters:

  • x (float) –

    deflate in X axis

  • y (float) –

    deflate in Y axis

Deflate(size: float)

Deflate in x,y axis concurrently.

Parameters:

  • size (float) –

    deflate in x and y axis concurrently.

Get

Get() -> tuple[Point2D, Point2D, Angle]

Get minimum point, maximum point and angle

Returns:

  • tuple[Point2D, Point2D, Angle]

    tuple(minimum point in local coordinate system, maximum point in local coordinate system, direction of X axis of new coordinate system)

GetAngle

GetAngle() -> Angle

Get direction of X axis of new coordinate system

Returns:

  • Angle

    angle direction of X axis of new coordinate system

GetBoxPoint

GetBoxPoint(_BoxPointLocation: eBoxPoint) -> Point2D

Get the box point

Parameters:

  • _BoxPointLocation (eBoxPoint) –

    Box point location

Returns:

GetCenter

GetCenter() -> Point2D

Get box center point in local coordinate system

Returns:

  • Point2D

    center point in local coordinates system

GetCenterPoint

GetCenterPoint() -> Point2D

Get world point at center of box

Returns:

GetHeight

GetHeight() -> float

Get height of box in local system

Returns:

  • float

    double

GetMax

GetMax() -> Point2D

Get maximum point in local coordinate system

Returns:

  • Point2D

    maximum point in local coordinate system

GetMaxPoint

GetMaxPoint() -> Point2D

Get world point at maximum of box

Returns:

GetMin

GetMin() -> Point2D

Get minimum point in local coordinate system

Returns:

GetMinPoint

GetMinPoint() -> Point2D

Get world point at maximum of box

Returns:

GetWidth

GetWidth() -> float

Get width of box in local system

Returns:

  • float

    double

Inflate overloaded

Inflate(x: float, y: float)

Inflate in x and y axis

Parameters:

  • x (float) –

    inflate in X axis

  • y (float) –

    inflate in Y axis

Inflate(size: float)

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:

Returns:

  • bool

    true, if is inside, otherwise false

IsContaining(minmax: MinMax2D) -> bool

Is minmax box inside this box

Parameters:

Returns:

  • bool

    true, if is inside, otherwise false

IsValid

IsValid() -> bool

Test if box is valid

Returns:

  • bool

    true, if box valid, otherwise false

Overlaps overloaded

Overlaps(box: BoundingBox2D) -> bool

Does box overlap this box

Parameters:

Returns:

  • bool

    true, if boxes overlap, otherwise false

Overlaps(minmax: MinMax2D) -> bool

Does minmax box overlap this box

Parameters:

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

Set(min: Point2D, max: Point2D, angle: Angle)

Set minimum point, maximum point and angle

Parameters:

  • min (Point2D) –

    minimum point in local coordinate system

  • max (Point2D) –

    maximum point in local coordinate system

  • angle (Angle) –

    angle between world X and local X coordinate system

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

SetHeight(height: float)

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

Parameters:

  • height (float) –

    Height

SetMax

SetMax(max: Point2D)

Set maximum point in local coordinate system

Parameters:

SetMin

SetMin(min: Point2D)

Set minimum point

Parameters:

  • min (Point2D) –

    minimum point in local coordinate system

SetWidth

SetWidth(width: float)

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:

Returns:

__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:

__eq__

__eq__(bounding_box: BoundingBox2D) -> bool

Comparison of bounding boxes.

Be careful, this method work without tolerance!

Parameters:

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:

Returns:

__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:

__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:

__init__ overloaded

__init__()

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__(min: Point2D, max: Point2D, angle: Angle)

Set constructor

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

Parameters:

  • min (Point2D) –

    minimum point in local coordinate system

  • max (Point2D) –

    maximum point in local coordinate system

  • angle (Angle) –

    direction of X axis of local coordinate system

__init__(boundingBox2D: BoundingBox2D)

Copy constructor.

Parameters:

__init__(minMax2D: MinMax2D)

Copy constructor.

Parameters:

  • minMax2D (MinMax2D) –

    MinMax2D to be copied

__repr__

__repr__() -> str

Convert to string

Placeholder