Skip to content

Commit

Permalink
feat: add AngularVelocity
Browse files Browse the repository at this point in the history
  • Loading branch information
unexcellent committed Nov 20, 2024
1 parent 21a4696 commit c50ab52
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
4 changes: 4 additions & 0 deletions generate/generate_boilerplate.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,10 @@ def _generat_zero_function(current_class: str) -> list[str]:
"degrees": "(3.141592653589793 / 180)",
"radians": "1",
},
"AngularVelocity": {
"degrees_per_second": "(3.141592653589793 / 180)",
"radians_per_second": "1",
},
"Area": {
"square_miles": "1609.34**2",
"square_kilometers": "10 ** (3 * 2)",
Expand Down
35 changes: 35 additions & 0 deletions quantio/quantities.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,41 @@ def zero(cls) -> Angle:
# --- End of auto generated part. ---


class AngularVelocity(_QuantityBase):
"""The change in angle per time."""

# --- This part is auto generated. Do not change manually. ---

BASE_UNIT = "radians_per_second"

@property
def degrees_per_second(self) -> float:
"""The angularvelocity in degrees per second."""
return self._base_value / (3.141592653589793 / 180)

@property
def radians_per_second(self) -> float:
"""The angularvelocity in radians per second."""
return self._base_value / 1

def __init__(
self,
_base_value: float = 0.0,
degrees_per_second: float = 0.0,
radians_per_second: float = 0.0,
) -> None:
self._base_value = _base_value
self._base_value += degrees_per_second * (3.141592653589793 / 180)
self._base_value += radians_per_second * 1

@classmethod
def zero(cls) -> AngularVelocity:
"""Create a AngularVelocity with a value of zero."""
return AngularVelocity()

# --- End of auto generated part. ---


class Area(_QuantityBase):
"""The two-dimensional extent of an object."""

Expand Down

0 comments on commit c50ab52

Please sign in to comment.