| Crates.io | starnav |
| lib.rs | starnav |
| version | 0.2.2 |
| created_at | 2025-02-28 21:01:20.296599+00 |
| updated_at | 2025-03-01 07:58:49.334706+00 |
| description | A comprehensive navigation system for celestial navigation in Star Citizen |
| homepage | |
| repository | https://github.com/19h/space-reversing/tree/master/nav-rs |
| max_upload_size | |
| id | 1573173 |
| size | 962,822 |
/\,%,_
\%%%/,\ In silence drift, through void unknown,
_.-"%%|//% A mapless path your screen has shown.
.' .-" /%%%
_.-'_.-" 0) \%%% Coordinates fade, the stars align,
/.\.' \%%% To whispers lost beyond defined.
\ / _, %%%
`"---"~`\ _,*'\%%' _,--""""-,%%,
)*^ `""~~` \%%%,
_/ \%%%
_.-`/ uncharted |%%,___
_.-" / worlds await your |%% .`\
/\ / gaze, their secrets \%' \ /
\ \ _,/ shine in stellar haze. \`""~~`
`"` /-.,_/ \
\___,' \.-"`/
`--'
Navigate shadows, chart the spark,
Secrets found in deepest dark.
A comprehensive 3D celestial navigation system with advanced pathfinding, coordinate transformations, and collision detection for space simulation environments.
Space Navigation System is a high-performance Rust library designed for accurate interplanetary navigation calculations with realistic physics considerations. It implements optimized bidirectional A* search with pre-computed visibility graphs, quaternion-based coordinate transformations, and sophisticated collision detection algorithms.
Add this to your Cargo.toml:
[dependencies]
space-navigation-system = "0.1.0"
use space_navigation_system::{SpaceNavigationSystem, types::StaticAstronomicalData};
fn main() {
// Load navigation data (containers and points of interest)
let data = StaticAstronomicalData::new(pois, containers);
// Create navigation system
let mut nav_system = SpaceNavigationSystem::new(data);
// Set current position (can be in local or global coordinates)
nav_system.set_position_local("Hurston", -328.91, -785.98, 564.17);
// Plan navigation to a destination
let plan = nav_system.plan_navigation("Shubin Mining Facility SCD-1");
if let Some(plan) = plan {
// Get human-readable navigation instructions
let instructions = nav_system.format_navigation_instructions(&plan);
println!("{}", instructions);
}
}
The navigation system is built with a modular architecture:
┌─────────────────────────────────────┐
│ SpaceNavigationSystem │
└───────────────┬─────────────────────┘
│
▼
┌─────────────────────────────────────┐
│ NavigationPlanner │
└───────────────┬─────────────────────┘
│
┌───────┴───────┐
▼ ▼
┌───────────────┐ ┌─────────────────────┐
│ NavigationCore│ │CoordinateTransformer│
└───────────────┘ └─────────────────────┘
▲ ▲
└───────┬───────┘
│
▼
┌─────────────────────────────────────┐
│ AstronomicalDataProvider │
└─────────────────────────────────────┘
Specialized utility for transforming coordinates between global and local reference frames with caching for expensive calculations.
let transformer = CoordinateTransformer::new();
let global_coords = transformer.transform_coordinates(
&local_coords,
&container,
TransformDirection::ToGlobal
);
Provides core navigation functionality including position tracking, vector calculations, and closest point determination.
let nav_core = NavigationCore::new(data_provider);
nav_core.set_position(x, y, z);
let nav_data = nav_core.get_navigation_data();
Advanced pathfinding system with bidirectional A* search and pre-computed visibility graphs for efficient route calculation.
let planner = NavigationPlanner::new(data_provider);
let plan = planner.plan_route("Lorville", "Shubin Mining Facility SCD-1");
Load celestial objects and points of interest from JSON files.
let containers = load_containers("data/containers.json")?;
let pois = load_pois("data/pois.json")?;
When executing a navigation plan, the system provides detailed instructions:
NAVIGATION PLAN
===============
ORIGIN: Hurston
SUMMARY:
Distance: 43,854,328 km
Estimated Travel Time: 14m 22s
Path Complexity: MultiJump
ROUTE SEGMENTS:
[1] Lorville → Hurston OM-1
Distance: 1,500.00 km
Travel Mode: Sublight
Time: 5m 10s
[2] Hurston OM-1 → Daymar OM-6
Distance: 19,204,875.23 km
Travel Mode: Quantum
Time: 5m 32s
Align: Pitch -1.4°, Yaw 223.7°
[3] Daymar OM-6 → Shubin Mining Facility SCD-1
Distance: 305.88 km
Travel Mode: Sublight
Time: 3m 40s
The system uses several specialized data structures:
The system implements several performance optimizations:
Contributions are welcome! Please feel free to submit a Pull Request.
git checkout -b feature/amazing-feature)git commit -m 'Add some amazing feature')git push origin feature/amazing-feature)This project is licensed under the MIT License - see the LICENSE file for details.
Note: This navigation system is designed for simulation environments and should not be used for real-world space navigation.