bluemira.geometry.inscribed_rect
Function to find inscribed rectangle.
In contained file because loop module imports geomtools and geombase modules
Functions
|
Find largest inscribed rectangle in a given polygon. |
Module Contents
- bluemira.geometry.inscribed_rect.inscribed_rect_in_poly(x_poly: numpy.ndarray, z_poly: numpy.ndarray, x_point: float, z_point: float, aspectratio: float = 1.0, *, convex: bool = True, rtol: float = 1e-06, atol: float = 1e-08) tuple[float, float]
Find largest inscribed rectangle in a given polygon.
- Parameters:
x_poly (numpy.ndarray) – x coordinates of the polygon
z_poly (numpy.ndarray) – z coordinates of the polygon
x_point (float) – x coordinate of the centroid of the
z_point (float) – z coordinate of the centroid of the rectangle
aspectratio (float) – aspect ratio of rectangle
convex (bool) – treat the loop as convex default:True
rtol (float) – The relative tolerance parameter (see Notes)
atol (float) – The absolute tolerance parameter (see Notes)
- Returns:
dx – half width of inscribed rectangle
dz – half height of inscribed rectangle
- Return type:
tuple[float, float]
Notes
See notes of https://numpy.org/doc/stable/reference/generated/numpy.isclose.html for an explanation of relative and absolute tolerances. The tolerances only affects non convex loops in certain complex situations. Setting either value to a very small value could cause the function to hang.