BoundingBox#
- class data_morph.bounds.bounding_box.BoundingBox(x_bounds: Interval | Iterable[Number], y_bounds: Interval | Iterable[Number], inclusive: Iterable[bool] = False)[source]#
Bases:
object
Class representing 2-dimensional range of numeric values.
- Parameters:
x_bounds (Union[Interval, Iterable[numbers.Number]]) – A 2-dimensional numeric iterable or an
Interval
object.y_bounds (Union[Interval, Iterable[numbers.Number]]) – A 2-dimensional numeric iterable or an
Interval
object.inclusive (bool, default
False
) – Whether the bounds include the endpoints. Default is exclusive. IfInterval
objects are provided, their settings are used.
- adjust_bounds(x: Number = None, y: Number = None) None [source]#
Adjust bounding box range.
- Parameters:
x (numbers.Number, optional) – The amount to change the x bound range by (half will be applied to each end).
y (numbers.Number, optional) – The amount to change the y bound range by (half will be applied to each end).
See also
Interval.adjust_bounds()
Method that performs the adjustment.
- property aspect_ratio: Number#
Calculate the aspect ratio of the bounding box.
- Returns:
The range in the x direction divided by the range in the y direction.
- Return type:
- clone() BoundingBox [source]#
Clone this instance.
- Returns:
A new
BoundingBox
instance with the same bounds.- Return type:
- property range: Iterable[Number]#
Calculate the range (width) of the bounding box in each direction.
- Returns:
The range covered by the x and y bounds, respectively.
- Return type:
Iterable[numbers.Number]