moon.py 1.3 KB
Newer Older
M
march3 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
# -*- coding:utf-8 -*-
# title           :
# description     :
# author          :Python超人
# date            :2023-01-22
# notes           :
# python_version  :3.8
# ==============================================================================
from bodies.body import Body, AU


class Moon(Body):
    """
    月球
    ------------------------
     距地距离约 363104 至 405696 km
      逃逸速度: 2.4 km/s
      公转速度: 1.023 km/s + (地球)29.79 km/s
      天体质量: 7.342✕10²² kg
      平均密度: 3.344 g/cm³ -> 3.344✕10³ kg/m³
    """

    # 质    量约  [1] 平均密度约 3.344 g/cm³ [1] 质    量约 7.342✕1022 kg [1]
    def __init__(self, name="Moon", mass=7.342e22,
                 init_position=[363104 + 1.12 * AU, 0, 0],
                 init_velocity=[0, 29.79 + 1.023, 0],
                 texture="moon.jpg", size_scale=1.0, distance_scale=1.0):
        params = {
            "name": name,
            "mass": mass,
            "init_position": init_position,
            "init_velocity": init_velocity,
            "density": 3.344e3,
            "color": (162, 162, 162),
            "texture": texture,
            "size_scale": size_scale,
            "distance_scale": distance_scale
        }
        super().__init__(**params)


if __name__ == '__main__':
    earth = Earth()
    print(earth)