earth.py 1.2 KB
Newer Older
M
march3 已提交
1 2 3 4 5 6 7 8
# -*- coding:utf-8 -*-
# title           :
# description     :
# author          :Python超人
# date            :2023-01-22
# notes           :
# python_version  :3.8
# ==============================================================================
M
march3 已提交
9
from bodies.body import Body, AU
M
march3 已提交
10 11 12 13 14 15 16 17 18 19 20 21 22 23


class Earth(Body):
    """
    地球
    ------------------------
     远日点距离: 152097701 km
     近日点距离: 147098074 km
      逃逸速度: 11.186 km/s
      公转速度: 29.79 km/s
      天体质量: 5.97237✕10²⁴ kg
      平均密度: 5507.85 kg/m³
    """

M
march3 已提交
24 25
    def __init__(self, name="Earth", mass=5.97237e24,
                 init_position=[1.12 * AU, 0, 0],
M
march3 已提交
26
                 init_velocity=[0, 29.79, 0],
M
march3 已提交
27
                 texture="earth1.jpg", size_scale=1.0, distance_scale=1.0):
M
march3 已提交
28 29 30 31 32 33
        params = {
            "name": name,
            "mass": mass,
            "init_position": init_position,
            "init_velocity": init_velocity,
            "density": 5507.85,
M
march3 已提交
34
            "color": (1, 89, 162),
M
march3 已提交
35 36 37 38 39 40 41 42 43 44
            "texture": texture,
            "size_scale": size_scale,
            "distance_scale": distance_scale
        }
        super().__init__(**params)


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