raimad.BBox
class
BBox(
raimad.bbox.AbstractBBox,
):
Unbound bounding box.
BBoxes define rectangles that encompass a set of points.
They offer methods for easily querying the dimensions of the
bounding box and specific points inside it.
This particular variant of bbox is "unbound", meaning
it is not tied to any proxy.
def interpolate(self, x_ratio: float, y_ratio: float) -> 'rai.typing.Point':
Find a point inside (or outside) the bbox given X and Y ratios.
So, for example, 0,0 is top left, 1,1 is bottom right, 0.5,0.5 is center, and 0.5,1 is bottom middle. The ratios may be negative or higher than 1, but doing so would probably make your code difficult to understand.
Parameters
x_ratio: float
A number, such that 0 represents all the way to the left of the bbox, and 1 represents all the way to the right.
y_ratio: float
A number, such that 0 represents all the way to the bottom of the bbox, and 1 represents all the way to the top.
Raises
EmptyBBoxError
if the bbox is empty