pytire.geometry

Geometry functions and objects

author

Alex Robinson <girotobial@gmail.com>

copyright

Copyright (c) Alex Robinson, 2021-2021.

license

MIT

Module Contents

Classes

ThreeDimensionalShape

Defines the interface for 3D shapes.

Cylinder

A right angled cylinder.

Cuboid

A rectangular cuboid

Torus

A torus https://en.wikipedia.org/wiki/Torus

SquareToroid

A toroid with a square cross section https://en.wikipedia.org/wiki/Toroid

NoneShape

Defines the interface for 3D shapes.

Functions

convert_length(length: float, from_unit: pytire.enums.Unit, to_unit: pytire.enums.Unit) → float

Changes length measurements between units

circle_area(radius: float) → float

calculates the area of a circle

create_shape(geometry: str, outer_diameter: Optional[float], width: Optional[float], inner_diameter: Optional[float]) → pytire.geometry.ThreeDimensionalShape

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 volume(self)Optional[float]
abstract classmethod from_tire_dimensions(cls, outer_diameter: float, width: float, inner_diameter: float)pytire.geometry.ThreeDimensionalShape
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

_validate_args(self)None
property radius(self)
volume(self)float
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

_validate_args(self)None
volume(self)float

the volume of the cuboid

classmethod from_tire_dimensions(cls, outer_diameter: float, width: float, inner_diameter: float)pytire.geometry.Cuboid
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.

_validate_args(self)None
cross_section_area(self)float
volume(self)float
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

_validate_args(self)None
volume(self)float
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.

volume(self)None
classmethod from_tire_dimensions(cls, outer_diameter: float, width: float, inner_diameter: float)
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.