diff options
author | Baitinq <you@example.com> | 2022-02-10 23:39:43 +0000 |
---|---|---|
committer | Baitinq <you@example.com> | 2022-02-10 23:39:43 +0000 |
commit | 9ebc639fb90a878e6b65800c689b89750b607b33 (patch) | |
tree | 8bc85900051de442743f9c802ac275a62cadaebd /src/body.py | |
parent | Started preparation to implement proper altitude calculations and gravity (diff) | |
download | OSLS-9ebc639fb90a878e6b65800c689b89750b607b33.tar.gz OSLS-9ebc639fb90a878e6b65800c689b89750b607b33.tar.bz2 OSLS-9ebc639fb90a878e6b65800c689b89750b607b33.zip |
Structured source files into src folder
Diffstat (limited to 'src/body.py')
-rw-r--r-- | src/body.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/body.py b/src/body.py new file mode 100644 index 0000000..3be2c5e --- /dev/null +++ b/src/body.py @@ -0,0 +1,21 @@ +import math + +from atmosphere import Atmosphere + +class Body(): + def __init__(self, name: str, density: int, radius: int, atmosphere: type[Atmosphere]): + self.name = name + self.density = density + self.radius = radius + self.atmosphere = atmosphere + + def mass(self): + body_volume = (4/3) * math.pi * (self.radius**3) + return body_volume * self.density * 1000 + + def g(self, G: float, height: int): + return (G * self.mass()) / ((self.radius + height) ** 2) + + + def __str__(self): + return "uwu" \ No newline at end of file |