# -*- coding:utf-8 -*- # title :宇宙模拟场景的基类 # description :可以作为宇宙模拟场景的基类,但是不是必须的 # author :Python超人 # date :2023-11-11 # link :https://gitcode.net/pythoncr/ # python_version :3.9 # ============================================================================== from common.celestial_data_service import get_reality_orbit_points from sim_scenes.universe_sim_scenes import UniverseSimScenes from simulators.ursina.ursina_mesh import create_orbit_by_points class SolarSystemRealityScenes(UniverseSimScenes): """ 可以作为太阳系宇宙模拟场景的基类,但是不是必须的。 """ @staticmethod def create_orbit_line(center_body, body, start_time, alpha=0.2): import math if not hasattr(body, "orbital_days"): return None orbital_days = int(math.ceil(body.orbital_days)) points = get_reality_orbit_points(type(body).__name__.lower(), start_time=start_time, days=orbital_days, segments=100) # print(points) orbit_line = create_orbit_by_points(center_body.position, points, line_color=body.trail_color, alpha=alpha, thickness=1) return orbit_line