Visualizer
- class dsns.visualizer.Visualizer(time_scale: float = 1.0, space_scale: float = 1e-06, viewport_size: tuple[int, int] = (800, 600), interplanetary_scale: float | None = None, bg_color: tuple[float, float, float] = (0.0, 0.0, 0.0))
Base class for visualizers, providing basic functionality for rendering bodies, constellations, and links.
- __init__(time_scale: float = 1.0, space_scale: float = 1e-06, viewport_size: tuple[int, int] = (800, 600), interplanetary_scale: float | None = None, bg_color: tuple[float, float, float] = (0.0, 0.0, 0.0))
Initialize the visualizer.
- Parameters:
time_scale – Visualization timescale (speed-up factor).
space_scale – Visualization space scale (should be small, to reduce numbers to a manageable level).
viewport_size – Size of the viewport (width, height).
interplanetary_scale – Scale for interplanetary distances. If None, this will be the same as space_scale (potentially resulting in very large distances).
bg_color – Background color.
- build_planet_material(texture_path: str, normal_map_path: str | None, metallic_roughness_map_path: str | None) PBRMaterial
Build a material for a planet.
- Parameters:
texture_path – Path to the texture image.
normal_map_path – Path to the normal map image.
roughness_map_path – Path to the roughness map image.
- Returns:
Material for the planet.
- generate_mesh_uvs(mesh: Trimesh) ndarray
Generate UVs for a spherical mesh.
- build_nodes_mesh(node_mesh: Trimesh, positions: ndarray) Mesh
Build a mesh for a set of nodes.
- Parameters:
node_mesh – Mesh for a single node.
positions – Positions of the nodes (before space_scale is applied).
- Returns:
Mesh for the nodes.
- build_nodes_mesh_from_sats(node_mesh: Trimesh, satellites: Satellites) Mesh
Build a mesh for a set of nodes from a set of satellites.
- Parameters:
node_mesh – Mesh for a single node.
satellites – Satellites to build a mesh for.
- Returns:
Mesh for the nodes.
- build_links_mesh(satellites: Satellites, links: list[tuple[int, int]], link_color: tuple[float, float, float]) Mesh | None
Build a mesh for a set of links.
- Parameters:
satellites – Satellites in the constellation.
links – Links to build a mesh for.
link_color – Color of the links.
- Returns:
Mesh for the links, or None if there are no links.
- update_simulation(t: float)
Update the simulation state.
- Parameters:
t – Time in seconds since the epoch.
- run_simulation(**kwargs)
- run_viewer()
Run the viewer. This should be called after run_simulation().
- class dsns.visualizer.ConstellationVisualizer(constellation: Constellation, show_isls: bool = True, time_scale: float = 1.0, space_scale: float = 1e-06, host_radius: float | None = None, host_rotation_period: float | None = None, viewport_size: tuple[int, int] = (800, 600), sat_color: tuple[float, float, float] = (1.0, 0.0, 0.0), isl_color: tuple[float, float, float] = (0.0, 1.0, 0.0), host_materials: tuple[str, str, str] | None = None, host_color: tuple[float, float, float] = (0.0, 0.0, 0.5), bg_color: tuple[float, float, float] = (0.0, 0.0, 0.0))
Visualizer class for rendering a constellation and ISLs.
- __init__(constellation: Constellation, show_isls: bool = True, time_scale: float = 1.0, space_scale: float = 1e-06, host_radius: float | None = None, host_rotation_period: float | None = None, viewport_size: tuple[int, int] = (800, 600), sat_color: tuple[float, float, float] = (1.0, 0.0, 0.0), isl_color: tuple[float, float, float] = (0.0, 1.0, 0.0), host_materials: tuple[str, str, str] | None = None, host_color: tuple[float, float, float] = (0.0, 0.0, 0.5), bg_color: tuple[float, float, float] = (0.0, 0.0, 0.0))
Initialize the visualizer.
- Parameters:
constellation – The constellation to visualize.
show_isls – Whether to show ISLs.
time_scale – Visualization timescale (speed-up factor).
space_scale – Visualization space scale (should be small, to reduce numbers to a manageable level).
host_radius – Radius of the host body (e.g. Earth). If None, no host body will be rendered.
host_rotation_period – Rotation period of the host body (in seconds).
viewport_size – Size of the viewport (width, height).
sat_color – Color of the satellites.
isl_color – Color of the ISLs.
host_materials – Tuple of paths to the host body’s diffuse, normal, and metallic-roughness maps.
host_color – Color of the host body.
bg_color – Background color.
- update_simulation(t: float)
Update the simulation state.
- Parameters:
t – Time in seconds since the epoch.
- class dsns.visualizer.MultiConstellationVisualizer(multiconstellation: MultiConstellation, show_links: bool = True, time_scale: float = 1.0, space_scale: float = 1e-06, interplanetary_scale: float | None = None, viewport_size: tuple[int, int] = (800, 600), sat_color: tuple[float, float, float] = (1.0, 0.0, 0.0), isl_color: tuple[float, float, float] = (0.0, 1.0, 0.0), ill_color: tuple[float, float, float] = (1.0, 0.0, 1.0), bg_color: tuple[float, float, float] = (0.0, 0.0, 0.0))
Visualizer class for rendering multiple constellations and their ISLs/ILLs.
- planets: list[tuple[Node, OrbitalCenter, float, float]] = []
- __init__(multiconstellation: MultiConstellation, show_links: bool = True, time_scale: float = 1.0, space_scale: float = 1e-06, interplanetary_scale: float | None = None, viewport_size: tuple[int, int] = (800, 600), sat_color: tuple[float, float, float] = (1.0, 0.0, 0.0), isl_color: tuple[float, float, float] = (0.0, 1.0, 0.0), ill_color: tuple[float, float, float] = (1.0, 0.0, 1.0), bg_color: tuple[float, float, float] = (0.0, 0.0, 0.0))
Initialize the visualizer.
- Parameters:
constellation – The constellation to visualize.
show_isls – Whether to show ISLs.
time_scale – Visualization timescale (speed-up factor).
space_scale – Visualization space scale (should be small, to reduce numbers to a manageable level).
interplanetary_scale – Scale for interplanetary distances. If None, this will be the same as space_scale (potentially resulting in very large distances).
viewport_size – Size of the viewport (width, height).
sat_color – Color of the satellites.
isl_color – Color of the ISLs.
bg_color – Background color.
- add_planet(radius: float, rotation_period: float, materials: tuple[str, str | None, str | None] | None = None, color: tuple[float, float, float] = (0.0, 0.0, 0.5), center: ~dsns.constellation.OrbitalCenter = <dsns.constellation.OrbitalCenter object>)
Add a planet to the visualization.
- Parameters:
radius – Radius of the planet.
rotation_period – Rotation period of the planet (in seconds).
materials – Tuple of paths to the planet’s diffuse, normal, and metallic-roughness maps.
color – Color of the planet.
center – Orbital center of the planet.
- update_simulation(t: float)
Update the simulation state.
- Parameters:
t – Time in seconds since the epoch.