Ellipse#
- class gbox.Ellipse(smj: float = 2.0, smn: float = 1.0, theta_1=0.0, theta_2=6.283185307179586, centre=(0.0, 0.0), smj_angle=0.0)#
Ellipse defined its centre, orientation of semi-major axs with the positive x-axs, starting and ending points (defined by the parametric values theta_1 and theta_2), semi-major and semi-minor axs lengths. It has perimeter, area, shape factor, locus, bounding box and union of circles representation properties.
>>> ellipse = Ellipse() >>> ellipse.smj # prints semi-major axs length, a >>> ellipse.smn # prints semi-minor axs length, b >>> ellipse.pivot_point # prints centre of the ellipse >>> ellipse.pivot_angle # prints orientation of the semi-major axs of the ellipse >>> ellipse.shape_factor # prints shape factor of the ellipse
- property perimeter#
Perimeter is approximated using the following Ramanujan formula
\[p = \pi[3(a+b) - \sqrt{(3a + b)(a + 3b)}]\]
- property area#
Area is evaluated using the following formula,
\[A = \pi a b\]
- property eccentricity#
Eccentricity of the ellipse, evaluated using
\[e = \sqrt{1 - \frac{b^2}{a^2}}\]
- property locus#
Determines the points along the locus of the ellipse.
\[x = a \cos{ \theta }, y = b \sin{ \theta }; \;\; \theta \in [\theta_1, \theta_2]\]
- property bounding_box#
Returns the coordinate-axs aligned bounds of the ellipse using the following formulae
\[ \begin{align}\begin{aligned}x = x_c \pm \sqrt{a^2 \cos^2 \theta + b^2 \sin^2 \theta}\\y = y_c \pm \sqrt{a^2 \sin^2 \theta + b^2 \cos^2 \theta}\end{aligned}\end{align} \]
- union_of_circles(buffer: float = 0.01) ClosedShapesList#
Returns union of circles representation for the Ellipse
- Parameters:
buffer – A small thickness around the shape to indicate the buffer region.
- Return type:
ClosedShapesList