fibomat.linalg.boundingboxes.boundingbox_base module

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

Bases: Generic[fibomat.linalg.boundingboxes.boundingbox_base.VectorT, fibomat.linalg.boundingboxes.boundingbox_base.ScalarT], abc.ABC

__init__(lower_left: numpy.ndarray, upper_right: numpy.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 lower_left: fibomat.linalg.boundingboxes.boundingbox_base.VectorT

Vector: lower left coordinate

Access:

get

property upper_right: fibomat.linalg.boundingboxes.boundingbox_base.VectorT

Vector: upper richt coordinate

Access:

get

property width: fibomat.linalg.boundingboxes.boundingbox_base.ScalarT

float: with of bounding box

Access:

get

property height: fibomat.linalg.boundingboxes.boundingbox_base.ScalarT

float: with of bounding box

Access:

get

property center: fibomat.linalg.boundingboxes.boundingbox_base.VectorT

Vector: center bounding box

Access:

get

clone() fibomat.linalg.boundingboxes.boundingbox_base.SelfT[source]

Clones the bounding box

Returns:

(BoundingBox): cloned box

scaled(val: float) fibomat.linalg.boundingboxes.boundingbox_base.SelfT[source]

Return a scaled version of the BoundingBox.

Args:

val: scale factor

Returns:

BoundingBox

overlaps_with(other: fibomat.linalg.boundingboxes.boundingbox_base.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: Union[fibomat.linalg.boundingboxes.boundingbox_base.BoundingBoxBase, fibomat.linalg.boundingboxes.boundingbox_base.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: Union[fibomat.linalg.boundingboxes.boundingbox_base.BoundingBoxBase, fibomat.linalg.boundingboxes.boundingbox_base.VectorT, Iterable[fibomat.linalg.boundingboxes.boundingbox_base.VectorT]]) fibomat.linalg.boundingboxes.boundingbox_base.SelfT[source]

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

Args:

other (BoundingBox): other box