Ellipse#

class gbox.ellipse.EllipticalArc(semi_major: float | float32, semi_minor: float | float32, centre: Tuple[float | float32, float | float32] | Point2D = (0.0, 0.0), major_axis_angle: float | float32 = 0.0, theta_start: float | float32 = 0.0, theta_end: float | float32 = np.float32(6.2831855))#

Bases: object

centre#
semi_major#
semi_minor#
major_axis_angle#
theta_start#
theta_end#
property area: float32#
perimeter(closure: Literal['open', 'e2e', 'ece'] = 'open') float32#

Computes the perimeter of the elliptical arc.

Parameters:
closurestr

Type of closure for the arc. Options are: - “open”: only the arc length is considered. - “e2e”: the arc length and the chord length between the two endpoints are considered. - “ece”: the arc length and the chord lengths from the endpoints to the centre are considered.

sample_points(num_points: int | None = None, point_density: float | float32 = 10.0) PointArray2D#

Samples points along the elliptical arc.

point_at_angle(theta: float | float32) Point2D#

Returns the point on the ellipse at the given angle.

points_at_parametric_points(theta: ndarray) PointArray2D#
get_bounding_box() BoundingBox#
aspect_ratio#
eccentricity#
class gbox.ellipse.Ellipse(semi_major: float | float32, semi_minor: float | float32, centre: Tuple[float | float32, float | float32] | Point2D = (0.0, 0.0), major_axis_angle: float | float32 = 0.0)#

Bases: object

arc#
copy()#
property semi_major: float32#
property semi_minor: float32#
property centre: Point2D#
property major_axis_angle: float32#
property aspect_ratio: float32#
property eccentricity: float32#
property area: float32#

Area of the ellipse.

property perimeter: float32#

Perimeter of the ellipse.

eval_boundary_points(num_points: int | None = None, point_density: float | float32 = 10.0) None#

Evaluate boundary points of the ellipse.

get_boundary_points(num_points: int = 100, point_density: float | float32 = 10.0) PointArray2D#

Returns the boundary points of the ellipse.

get_bounding_box() BoundingBox#
contains(p: Point2D | Tuple[float | float32, float | float32], atol: float | float32 = 1e-06) Literal[-1, 0, 1]#

Checks if a point is inside, on, or outside the ellipse.

Returns:
-1point is outside the ellipse
0point is on the ellipse
1point is inside the ellipse
r_shortest(xi: float | float32) float32#

Evaluates the shortest distance to the ellipse locus from a point on the major axis located at a distance xi from the centre of the ellipse.

union_of_circles(dh: float | float32 = 0.0) CirclesArray#
plot(axs, *, b_box: bool = False, uoc: bool = False, **kwargs)#
class gbox.ellipse.CircularArc(radius: float | float32, centre: Tuple[float | float32, float | float32] | Point2D = (0.0, 0.0), theta_1: float | float32 = 0.0, theta_2: float | float32 = np.float32(6.2831855))#

Bases: EllipticalArc

semi_major#
semi_minor#
centre#
major_axis_angle#
theta_start#
theta_end#
aspect_ratio#
eccentricity#
class gbox.ellipse.Circle(radius: float | float32, centre: Tuple[float | float32, float | float32] | Point2D = (0.0, 0.0))#

Bases: object

radius: float | float32#
centre: Point2D#
arc: Ellipse#
property area: float32#
property perimeter: float32#
contains(p: Point2D | Tuple[float | float32, float | float32], tol=1e-08) Literal[-1, 0, 1]#
distance_to(c: Circle) float32#
class gbox.ellipse.CirclesArray(circles: List[Circle] | ndarray[tuple[int, ...], dtype[_ScalarType_co]] | None = None, initial_capacity: int = 100)#

Bases: object

add_circles(circles: List[Circle] | ndarray[tuple[int, ...], dtype[_ScalarType_co]]) None#

Add circles from either a list of Circle objects or a numpy array

transform(angle: float | float32 = 0.0, dx: float | float32 = 0.0, dy: float | float32 = 0.0, pivot: Point2D | Tuple[float | float32, float | float32] = (0.0, 0.0), scale: float | float32 | ndarray[tuple[int, ...], dtype[_ScalarType_co]] = 1.0) None#

Updates the current circle set by transformation

clip(x_lim: Tuple[float | float32, float | float32] = (-inf, inf), y_lim: Tuple[float | float32, float | float32] = (-inf, inf), r_lim: Tuple[float | float32, float | float32] = (0.0, inf), inplace: bool = True) ndarray[tuple[int, ...], dtype[_ScalarType_co]] | None#

Returns a copy of circles array within the limits

property xc: ndarray[tuple[int, ...], dtype[_ScalarType_co]]#
property yc: ndarray[tuple[int, ...], dtype[_ScalarType_co]]#
property radii: ndarray[tuple[int, ...], dtype[_ScalarType_co]]#
property centres: ndarray[tuple[int, ...], dtype[_ScalarType_co]]#
property data: ndarray[tuple[int, ...], dtype[_ScalarType_co]]#
centres_point_array() PointArray2D#
bounding_box() BoundingBox#
perimeters()#
areas()#
distances_to(p: Point2D | Tuple[float | float32, float | float32]) ndarray[tuple[int, ...], dtype[_ScalarType_co]]#
contains(p: Point2D | Tuple[float | float32, float | float32], rtol: float | float32 = 1e-06) Literal[-1, 0, 1]#
evaluate_boundaries(pointer_per_circle: int = 36, cycle: bool = False)#
plot(axs, *, plot_bbox: bool = False, **kwargs) None#