2D geometry¶
-
class
pyeng.general.geometry.geom_2d.Circle(radius, fail_silently=True)¶ Represents a circle tangent to the x- and y-axes (see figure). Derived geometrical properties are calculated upon object creation.
Parameters: radius – Radius (NOT diameter) of the circle (\(a\)) [\(m\)] - Suggested range: 0.0<=radius \[ \begin{align}\begin{aligned}A = \pi a^2\\x_c = a\\y_c = a\\I_{x_c} = \frac{\pi a^4}{4}\\I_{y_c} = \frac{\pi a^4}{4}\\I_x = \frac{5 \pi a^4}{4}\\I_y = \frac{5 \pi a^4}{4}\\J = \frac{\pi a^4}{2}\\r^2_{x_c} = \frac{a^2}{4}\\r^2_{y_c} = \frac{a^2}{4}\\r^2_{x} = \frac{5 a^2}{4}\\r^2_{y} = \frac{5 a^2}{4}\\r^2_{p} = \frac{a^2}{2}\\I_{x_c y_c} = 0\\I_{xy} = A a^2\end{aligned}\end{align} \]
-
class
pyeng.general.geometry.geom_2d.CircleSector(radius, angle, fail_silently=True)¶ Represents a circle sector divided in two by the x-axis and with circle center at the origin (see figure). Derived geometrical properties are calculated upon object creation.
Parameters: - radius – Radius of the circle sector (\(a\)) [\(m\)] - Suggested range: 0.0<=radius
- angle – Absolute value of the angle between the x-axis and the edge of the circle sector (\(\theta\)) [\(deg\)] - Suggested range: 0.0<=angle<=90.0
\[ \begin{align}\begin{aligned}A = a^2 \theta\\x_c = \frac{2 a}{3} \frac{\sin \theta}{\theta}\\y_c = 0\\I_x = \frac{a^4 (\theta - \sin \theta \cos \theta)}{4}\\I_y = \frac{a^4 (\theta + \sin \theta \cos \theta)}{4}\\r^2_{x} = \frac{a^2}{4} \frac{\theta - \sin \theta \cos \theta}{\theta}\\r^2_{y} = \frac{a^2}{4} \frac{\theta + \sin \theta \cos \theta}{\theta}\\I_{x_c y_c} = 0\\I_{xy} = 0\end{aligned}\end{align} \]
-
class
pyeng.general.geometry.geom_2d.CircleSegment(radius, angle, fail_silently=True)¶ Represents a circle segment divided in two by the x-axis and with circle center at the origin (see figure). Derived geometrical properties are calculated upon object creation.
Parameters: - radius – Radius of the circle segment (\(a\)) [\(m\)] - Suggested range: 0.0<=radius
- angle – Absolute value of the angle between the x-axis and the edge of the circle sector (\(\theta\)) [\(deg\)] - Suggested range: 0.0<=angle<=90.0
\[ \begin{align}\begin{aligned}A = a^2 \left( \theta - \frac{\sin (2 \theta)}{2} \right)\\x_c = \frac{2 a}{3} \frac{\sin ^3 \theta}{\theta - \sin \theta \cos \theta}\\y_c = 0\\I_x = \frac{A a^2}{4} \left[ 1 - \frac{2 \sin ^3 \theta \cos \theta}{3 \theta - 3 \sin \theta \cos \theta} \right]\\I_y = \frac{A a^2}{4} \left[ 1 + \frac{2 \sin ^3 \theta \cos \theta}{\theta - \sin \theta \cos \theta} \right]\\r^2_{x} = \frac{a^2}{4} \left[ 1 - \frac{2 \sin ^3 \theta \cos \theta}{3 \theta - 3 \sin \theta \cos \theta} \right]\\r^2_{y} = \frac{a^2}{4} \left[ 1 + \frac{2 \sin ^3 \theta \cos \theta}{\theta - \sin \theta \cos \theta} \right]\\I_{x_c y_c} = 0\\I_{xy} = A a^2\end{aligned}\end{align} \]
-
class
pyeng.general.geometry.geom_2d.HalfParabola(width, height, fail_silently=True)¶ Represents one half of a parabola, the proportion above the x-axis (see figure). Derived geometrical properties are calculated upon object creation.
Parameters: - width – Offset between the origin and the edge of the shape, measured along the x-axis (\(a\)) [\(m\)] - Suggested range: 0.0<=width
- height – Height of the parabola measured from the x-axis to the parabola curve (\(b\)) [\(m\)] - Suggested range: 0.0<=height
\[ \begin{align}\begin{aligned}A = \frac{2 a b}{3}\\x_c = \frac{3 a}{5}\\y_c = \frac{3 b}{8}\\I_x = \frac{2 a b^3}{15}\\I_y = \frac{2 a^3 b}{7}\\r^2_{x} = \frac{b^2}{5}\\r^2_{y} = \frac{3 a^2}{7}\end{aligned}\end{align} \]
-
class
pyeng.general.geometry.geom_2d.NDegreeParabolaInside(width, height, exponent, fail_silently=True)¶ Represents the inside of an Nth degree parabola, positioned above the x-axis (see figure). Derived geometrical properties are calculated upon object creation.
Parameters: - width – Width of the Nth degree parabola measured along the x-axis (\(b\)) [\(m\)] - Suggested range: 0.0<=width
- height – Height of the Nth degree parabola (\(h\)) [\(m\)] - Suggested range: 0.0<=height
- exponent – Exponent of the Nth degree parabola (\(n\)) [\(-\)] - Suggested range: 0.0<=exponent
\[ \begin{align}\begin{aligned}A = \frac{n}{n + 1} b h\\x_c = \frac{n + 1}{2n + 1} b\\y_c = \frac{n + 1}{2 (n + 2)} h\\I_x = \frac{n}{3 (n + 3)} b h^3\\I_y = \frac{n}{3n + 1} b^3 h\\r^2_{x} = \frac{n + 1}{3 (n + 1)} h^2\\r^2_{y} = \frac{n + 1}{3n + 1} b^2\\y = \frac{h}{b^{1/n}} x^{1/n}\end{aligned}\end{align} \]
-
class
pyeng.general.geometry.geom_2d.NDegreeParabolaOutside(width, height, exponent, fail_silently=True)¶ Represents the outside of an Nth degree parabola, positioned above the x-axis (see figure). Derived geometrical properties are calculated upon object creation.
Parameters: - width – Width of the Nth degree parabola measured along the x-axis (\(b\)) [\(m\)] - Suggested range: 0.0<=width
- height – Height of the Nth degree parabola (\(h\)) [\(m\)] - Suggested range: 0.0<=height
- exponent – Exponent of the Nth degree parabola (\(n\)) [\(-\)] - Suggested range: 0.0<=exponent
\[ \begin{align}\begin{aligned}A = \frac{b h}{n + 1}\\x_c = \frac{n + 1}{n + 2} b\\y_c = \frac{h}{2} \frac{n + 1}{2n + 1}\\I_x = \frac{b h^3}{3 (3n + 1)}\\I_y = \frac{h b^3}{n + 3}\\r^2_{x} = \frac{h^2 (n + 1)}{3 (3n + 1)}\\r^2_{y} = \frac{n + 1}{n + 3} b^2\\y = \frac{h}{b^n} x^n\end{aligned}\end{align} \]
-
class
pyeng.general.geometry.geom_2d.Parabola(width, height, fail_silently=True)¶ Represents a parabola divided in two by the x-axis (see figure). Derived geometrical properties are calculated upon object creation.
Parameters: - width – Offset between the origin and the edge of the parabola (\(a\)) [\(m\)] - Suggested range: 0.0<=width
- height – Height of the parabola measured from the x-axis to the intersection with the parabola (\(b\)) [\(m\)] - Suggested range: 0.0<=height
\[ \begin{align}\begin{aligned}A = \frac{4 a b}{3}\\x_c = \frac{3 a}{5}\\y_c = 0\\I_{x_c} = \frac{4 a b^3}{15}\\I_{y_c} = \frac{16 a^3 b}{175}\\I_x = \frac{4 a b^3}{15}\\I_y = \frac{4 a^3 b}{7}\\r^2_{x_c} = \frac{b^2}{5}\\r^2_{y_c} = \frac{12 a^2}{175}\\r^2_{x} = \frac{b^2}{5}\\r^2_{y} = \frac{3 a^2}{7}\\I_{x_c y_c} = 0\\I_{xy} = 0\end{aligned}\end{align} \]
-
class
pyeng.general.geometry.geom_2d.Parallellogram(length_x, length_inclined, angle, fail_silently=True)¶ Represents a parallellogram with one side aligned with the x-axis (see figure). Derived geometrical properties are calculated upon object creation.
Parameters: - length_x – Length of the parallellogram side aligned with the x-axis (\(b\)) [\(m\)] - Suggested range: 0.0<=length_x
- length_inclined – Length of the inclined side of the parallellogram (\(a\)) [\(m\)] - Suggested range: 0.0<=length_inclined
- angle – Angle between the x-axis and the inclined side (\(\theta\)) [\(deg\)] - Suggested range: 0.0<=angle<=90.0
\[ \begin{align}\begin{aligned}A = a b \sin \theta\\x_c = \frac{b + a \cos \theta}{2}\\y_c = \frac{a \sin \theta}{2}\\I_{x_c} = \frac{a^3 b \sin ^3 \theta}{12}\\I_{y_c} = \frac{\left[ a b \sin \theta (b^2 + a^2 \cos ^2 \theta) \right]}{12}\\I_x = \frac{a^3 b \sin ^3 \theta}{3}\\I_y = \frac{\left[ a b \sin \theta (b^2 + a^2 \cos ^2 \theta) \right]}{3} - \frac{a^2 b^2 \sin \theta \cos \theta}{6}\\r^2_{x_c} = \frac{(a \sin \theta)^2}{12}\\r^2_{y_c} = \frac{b^2 + a^2 \cos ^2 \theta}{12}\\r^2_{x} = \frac{(a \sin \theta)^2}{3}\\r^2_{y} = \frac{(b + a \cos \theta)^2}{3} - \frac{a b \cos \theta}{6}\\I_{x_c y_c} = \frac{a^3 b \sin ^2 \theta \cos \theta}{12}\end{aligned}\end{align} \]
-
class
pyeng.general.geometry.geom_2d.Rectangle(base_width, height, fail_silently=True)¶ Represents a rectangle with sides aligned with the x- and y-axes (see figure). Derived geometrical properties are calculated upon object creation.
Parameters: - width – Width of the rectangle (\(b\)) [\(m\)] - Suggested range: 0.0<=width
- height – Height of the rectangle (\(h\)) [\(m\)] - Suggested range: 0.0<=height
\[ \begin{align}\begin{aligned}A = b h\\x_c = \frac{b}{2}\\y_c = \frac{h}{2}\\I_{x_c} = \frac{b h^3}{12}\\I_{y_c} = \frac{b^3 h}{12}\\I_x = \frac{b h^3}{3}\\I_y = \frac{b^3 h}{3}\\J = \frac{\left[ bh (b^2 + h^2) \right]}{12}\\r^2_{x_c} = \frac{h^2}{12}\\r^2_{y_c} = \frac{b^2}{12}\\r^2_{x} = \frac{h^2}{3}\\r^2_{y} = \frac{b^2}{3}\\r^2_{p} = \frac{b^2 + h^2}{12}\\I_{x_c y_c} = 0\\I_{xy} = \frac{b^2 h^2}{4}\end{aligned}\end{align} \]
-
class
pyeng.general.geometry.geom_2d.RightTriangleLeft(base_width, height, fail_silently=True)¶ Represents a right triangle with the right angle on the left (see figure). Derived geometrical properties are calculated when an instance is created
Parameters: - base_width – Width of the triangle base (\(b\)) [\(m\)] - Suggested range: 0.0<=base_width
- height – Height of the triangle (\(h\)) [\(m\)] - Suggested range: 0.0<=height
\[ \begin{align}\begin{aligned}A = \frac{b h}{2}\\x_c = \frac{b}{3}\\y_c = \frac{h}{3}\\I_{x_c} = \frac{b h^3}{36}\\I_{y_c} = \frac{b^3 h}{36}\\I_x = \frac{b h^3}{12}\\I_y = \frac{b^3 h}{12}\\r^2_{x_c} = \frac{h^2}{18}\\r^2_{y_c} = \frac{b^2}{18}\\r^2_{x} = \frac{h^2}{6}\\r^2_{y} = \frac{b^2}{6}\\I_{x_c y_c} = \frac{- b^2 h^2}{72}\\I_{xy} = \frac{b^2 h^2}{24}\end{aligned}\end{align} \]
-
class
pyeng.general.geometry.geom_2d.RightTriangleRight(base_width, height, fail_silently=True)¶ Represents a right triangle with the right angle on the right (see figure). Derived geometrical properties are calculated when an instance is created
Parameters: - base_width – Width of the triangle base (\(b\)) [\(m\)] - Suggested range: 0.0<=base_width
- height – Height of the triangle (\(h\)) [\(m\)] - Suggested range: 0.0<=height
\[ \begin{align}\begin{aligned}A = \frac{b h}{2}\\x_c = \frac{2 b}{3}\\y_c = \frac{h}{3}\\I_{x_c} = \frac{b h^3}{36}\\I_{y_c} = \frac{b^3 h}{36}\\I_x = \frac{b h^3}{12}\\I_y = \frac{b^3 h}{4}\\r^2_{x_c} = \frac{h^2}{18}\\r^2_{y_c} = \frac{b^2}{18}\\r^2_{x} = \frac{h^2}{6}\\r^2_{y} = \frac{b^2}{2}\\I_{x_c y_c} = \frac{b^2 h^2}{72}\\I_{xy} = \frac{b^2 h^2}{8}\end{aligned}\end{align} \]
-
class
pyeng.general.geometry.geom_2d.Ring(outer_radius, inner_radius, fail_silently=True)¶ Represents a ring tangent to the x- and y-axes (see figure). Derived geometrical properties are calculated upon object creation.
Parameters: - outer_radius – Outer radius of the ring (\(a\)) [\(m\)] - Suggested range: 0.0<=outer_radius
- inner_radius – Inner radius of the ring (\(b\)) [\(m\)] - Suggested range: 0.0<=inner_radius
\[ \begin{align}\begin{aligned}A = \pi (a^2 - b^2)\\x_c = a\\y_c = a\\I_{x_c} = \frac{\pi (a^4 - b^4)}{4}\\I_{y_c} = \frac{\pi (a^4 - b^4)}{4}\\I_x = \frac{5 \pi a^4}{4} - \pi a^2 b^2 - \frac{\pi b^4}{4}\\I_y = \frac{5 \pi a^4}{4} - \pi a^2 b^2 - \frac{\pi b^4}{4}\\J = \frac{\pi (a^4 - b^4)}{2}\\r^2_{x_c} = \frac{a^2 + b^2}{4}\\r^2_{y_c} = \frac{a^2 + b^2}{4}\\r^2_{x} = \frac{5 a^2 + b^2}{4}\\r^2_{y} = \frac{5 a^2 + b^2}{4}\\r^2_{p} = \frac{a^2+ b^2}{2}\\I_{x_c y_c} = 0\\I_{xy} = \pi a^2 (a^2 - b^2)\end{aligned}\end{align} \]
-
class
pyeng.general.geometry.geom_2d.SemiCircle(radius, fail_silently=True)¶ Represents a semicircle passing through the origin and with circle center on the x-axis (see figure). Derived geometrical properties are calculated upon object creation.
Parameters: radius – Radius (NOT diameter) of the semicircle (\(a\)) [\(m\)] - Suggested range: 0.0<=radius \[ \begin{align}\begin{aligned}A = \frac{\pi a^2}{2}\\x_c = a\\y_c = \frac{4 a}{3 \pi}\\I_{x_c} = \frac{a^4 (9 \pi^2 - 64)}{72 \pi}\\I_{y_c} = \frac{\pi a^4}{8}\\I_x = \frac{\pi a^4}{8}\\I_y = \frac{5 \pi a^4}{8}\\r^2_{x_c} = \frac{a^2 (9 \pi^2 - 64)}{36 \pi^2}\\r^2_{y_c} = \frac{a^2}{4}\\r^2_{x} = \frac{a^2}{4}\\r^2_{y} = \frac{5 a^2}{4}\\I_{x_c y_c} = 0\\I_{xy} = \frac{2 a^2}{3}\end{aligned}\end{align} \]
-
class
pyeng.general.geometry.geom_2d.Trapezoid(longest_base, shortest_base, height, fail_silently=True)¶ Represents a trapezoid with longest base aligned with the x-axis (see figure). Derived geometrical properties are calculated upon object creation.
Parameters: - longest_base – Length of the longest base (\(b\)) [\(m\)] - Suggested range: 0.0<=longest_base
- shortest_base – Length of the shortest base (\(a\)) [\(m\)] - Suggested range: 0.0<=shortest_base<longest_base
- height – Height of the trapezoid (\(h\)) [\(m\)] - Suggested range: 0.0<=height
\[ \begin{align}\begin{aligned}A = \frac{h (a+b)}{2}\\y_c = \frac{h(2a+b)}{3(a+b)}\\I_{x_c} = \frac{h^3 (a^2 + 4 a b + b^2)}{36 (a + b)}\\I_x = \frac{h^3 (3a + b)}{12}\\r^2_{x_c} = \frac{h^2 (a^2 + 4 a b + b^2)}{18 (a + b)}\\r^2_{x} = \frac{h^2 (3a + b)}{6 (a + b)}\end{aligned}\end{align} \]
-
class
pyeng.general.geometry.geom_2d.TriangleGeneric(base_full_width, base_offset, height, fail_silently=True)¶ Represents a generic triangle with the long edge aligned with the x-axis (see figure). Derived geometrical properties are calculated upon object creation.
Parameters: - base_full_width – Width of the triangle base (\(b\)) [\(m\)] - Suggested range: 0.0<=base_full_width
- base_offset – Distance between the origin and the highest vertex, measured along the x-axis (\(a\)) [\(m\)] - Suggested range: 0.0<=base_offset<base_full_width
- height – Height of the triangle (\(h\)) [\(m\)] - Suggested range: 0.0<=height
\[ \begin{align}\begin{aligned}A = \frac{b h}{2}\\x_c = \frac{a + b}{3}\\y_c = \frac{h}{3}\\I_{x_c} = \frac{b h^3}{36}\\I_{y_c} = \frac{\left[ b h (b^2 - ab + a^2) \right]}{36}\\I_x = \frac{b h^3}{12}\\I_y = \frac{\left[ b h (b^2 + ab + a^2) \right]}{12}\\r^2_{x_c} = \frac{h^2}{18}\\r^2_{y_c} = \frac{b^2 - ab + a^2}{18}\\r^2_{x} = \frac{h^2}{6}\\r^2_{y} = \frac{b^2 + ab + a^2}{6}\\I_{x_c y_c} = \frac{b h^2 (2a - b)}{72}\\I_{xy} = \frac{b h^2 (2a + b)}{24}\end{aligned}\end{align} \]
-
class
pyeng.general.geometry.geom_2d.TwodimensionalShape¶ Calculates geometrical properties of a 2D shape
Returns: Area of the shape (\(A\)) [\(m2\)], x-coordinate of the centroid (\(x_c\)) [\(m\)], y-coordinate of the centroid (\(y_c\)) [\(m\)], Area moment of inertia about the centroidal x-axis (\(I_{x_c}\)) [\(m4\)], Area moment of inertia about the centroidal y-axis (\(I_{y_c}\)) [\(m4\)], Area moment of inertia about the x-axis (\(I_x\)) [\(m4\)], Area moment of inertia about the y-axis (\(I_y\)) [\(m4\)], Polar area moment of inertia (\(J\)) [\(m4\)], Radius of gyration relative to the centroidal x-axis (\(r_{x_c}\)) [\(m\)], Radius of gyration relative to the centroidal y-axis (\(r_{y_c}\)) [\(m\)], Radius of gyration relative to the x-axis (\(r_x\)) [\(m\)], Radius of gyration relative to the y-axis (\(r_y\)) [\(m\)], Polar radius of gyration (\(r_p\)) [\(m\)], Product of inertia relative to the centroid (\(I_{x_c y_c}\)) [\(m4\)], Product of inertia relative to the axes shown in the figure (\(i_{xy}\)) [\(m4\)] Return type: Python dictionary with keys: centroid[‘area [m2]’],centroid[‘x [m]’],centroid[‘y [m]’],areamoment_inertia[‘I_xc [m4]’], areamoment_inertia[‘I_yc [m4]’],areamoment_inertia[‘I_x [m4]’],areamoment_inertia[‘I_y [m4]’],radius_gyration[‘r_xc [m]’], radius_gyration[‘r_yc [m]’],radius_gyration[‘r_x [m]’],radius_gyration[‘r_y [m]’],product_inertia[‘I_xc_yc [m4]’], product_inertia[‘I_xy [m4]’] Reference - Wikipedia: https://en.wikipedia.org/wiki/List_of_second_moments_of_area