fibomat.linalg.boundingboxes.boundingbox_base module#

class fibomat.linalg.boundingboxes.boundingbox_base.BoundingBoxBase(lower_left: ndarray, upper_right: ndarray)[source]#

Bases: Generic[VectorT, ScalarT], ABC

__init__(lower_left: ndarray, upper_right: ndarray)[source]#
abstract classmethod from_points(points: Iterable[VectorT]) BoundingBoxBase[VectorT][source]#

Constructs rectangular bounding box containing all points

Args:

points (VectorArrayLike): points which should be included in bounding box description (str, optional): description

Returns:

(BoundingBox): new BoundingBox

close_to(other: object) bool[source]#
property corners: Iterable[VectorT]#
property lower_left: VectorT#

Vector: lower left coordinate

Access:

get

property upper_right: VectorT#

Vector: upper richt coordinate

Access:

get

property width: ScalarT#

float: with of bounding box

Access:

get

property height: ScalarT#

float: with of bounding box

Access:

get

property area: ScalarT#

float: area of bounding box

Access:

get

property center: VectorT#

Vector: center bounding box

Access:

get

clone() SelfT[source]#

Clones the bounding box

Returns:

(BoundingBox): cloned box

scaled(val: float) SelfT[source]#

Return a scaled version of the BoundingBox.

Args:

val: scale factor

Returns:

BoundingBox

overlaps_with(other: BoundingBoxBase) bool[source]#

Checks if this bounding box overlaps with other.

Args:

other: other bounding box

Returns:

bool: True if self and other overlap

contains(other: BoundingBoxBase | VectorT) bool[source]#

Checks if this bounding box contains other. Alternatively, you can use in syntax. Note, that a box is contains always itself.

box_1 = BoundingBox([1, 2], [3, 4])
box_2 = BoundingBox([1, 3], [0, 4])

print(box_1.contains(box_2)
# or
print(box_2 in box_1)
Args:

other (BoundingBox): other box

Returns:

(bool): True if self contains other

extended(other: BoundingBoxBase | VectorT | Iterable[VectorT]) SelfT[source]#

Return a extended bounding box so that self and other are contained

Args:

other (BoundingBox): other box