pytire.geometry
¶
Geometry functions and objects
- author
Alex Robinson <girotobial@gmail.com>
- copyright
Copyright (c) Alex Robinson, 2021-2021.
- license
MIT
Module Contents¶
Classes¶
Defines the interface for 3D shapes. |
|
A right angled cylinder. |
|
A rectangular cuboid |
|
A toroid with a square cross section https://en.wikipedia.org/wiki/Toroid |
|
Defines the interface for 3D shapes. |
Functions¶
|
Changes length measurements between units |
|
calculates the area of a circle |
|
3D Shape factory function |
-
pytire.geometry.
convert_length
(length: float, from_unit: pytire.enums.Unit, to_unit: pytire.enums.Unit) → float¶ Changes length measurements between units
- lengthfloat
measurement to convert
- from_unitUnit
A Unit object to convert from.
- to_unitUnit
A Unit object to convert to.
- float
converted length in to_unit
-
pytire.geometry.
circle_area
(radius: float) → float¶ calculates the area of a circle
- radiusfloat
the radius of the circle
- float
the area of the circle
-
class
pytire.geometry.
ThreeDimensionalShape
¶ Bases:
abc.ABC
Defines the interface for 3D shapes.
-
abstract classmethod
from_tire_dimensions
(cls, outer_diameter: float, width: float, inner_diameter: float) → pytire.geometry.ThreeDimensionalShape¶
-
abstract classmethod
-
class
pytire.geometry.
Cylinder
(diameter: float, width: float)¶ Bases:
pytire.geometry.ThreeDimensionalShape
A right angled cylinder.
- diameterfloat
the length of the straight line that passes through the center of the circular cross section
- widthfloat
The length of the side orthagonol to the circular cross section
-
property
radius
(self)¶
-
classmethod
from_tire_dimensions
(cls, outer_diameter: float, width: float, inner_diameter: float) → pytire.geometry.Cylinder¶
-
class
pytire.geometry.
Cuboid
(height: float, length: float, width: float)¶ Bases:
pytire.geometry.ThreeDimensionalShape
A rectangular cuboid
height : float
length : float
width : float
-
classmethod
from_tire_dimensions
(cls, outer_diameter: float, width: float, inner_diameter: float) → pytire.geometry.Cuboid¶
-
classmethod
-
class
pytire.geometry.
Torus
(cross_section_radius: float, radius_of_revolution: float)¶ Bases:
pytire.geometry.ThreeDimensionalShape
A torus https://en.wikipedia.org/wiki/Torus
- cross_section_radiusfloat
the radius of the circular cross section that is rotated around the radius of revolution aka “the minor radius”
- radius_of_revolutionfloat
the radius of the larger circle, around the perimeter of which, the smaller circle is rotated.
-
classmethod
from_tire_dimensions
(cls, outer_diameter: float, width: float, inner_diameter: float) → pytire.geometry.Torus¶
-
class
pytire.geometry.
SquareToroid
(outer_diameter: float, width: float, inner_diameter: float)¶ Bases:
pytire.geometry.ThreeDimensionalShape
A toroid with a square cross section https://en.wikipedia.org/wiki/Toroid
- outer_diameterfloat
The widest diameter of the toroid
- widthfloat
The width of the axis orthaganol to the plane of rotation
- inner_diameterfloat
The diameter of the central hole
-
classmethod
from_tire_dimensions
(cls, outer_diameter: float, width: float, inner_diameter: float) → pytire.geometry.SquareToroid¶
-
class
pytire.geometry.
NoneShape
¶ Bases:
pytire.geometry.ThreeDimensionalShape
Defines the interface for 3D shapes.
-
pytire.geometry.
create_shape
(geometry: str, outer_diameter: Optional[float], width: Optional[float], inner_diameter: Optional[float]) → pytire.geometry.ThreeDimensionalShape¶ 3D Shape factory function
- geometrystr
The 3D shape that you want to be bult. One of [‘cuboid’, ‘cylinder’, ‘square_toroid’, ‘torus’]
- outer_diameterOptional[float]
Outer diameter of the tire
- widthOptional[float]
Width of the tire
- inner_diameterOptional[float]
Inner diameter of the tire
- ThreeDimensionalShape
Shape object
- ValueError
raised if geometry is not available.