3 unstable releases
Uses new Rust 2024
| 0.2.0 | Sep 23, 2025 |
|---|---|
| 0.1.1 | Sep 23, 2025 |
| 0.1.0 | Sep 21, 2025 |
#7 in #spherical
67 downloads per month
Used in chronovox
12KB
178 lines
uvoxxyz
Created by JDPlumbing
📦 Installation
cargo install uvoxxyz
Bridge between spherical UvoxId coordinates and Cartesian space, with quaternion support.
uvoxxyz lets you:
- Convert between
uvoxidspherical IDs and 3D Cartesian coordinates. - Choose between math convention (X/Y horizontal, Z up) and graphics convention (X/Z horizontal, Y up).
- Apply quaternions for orientation and rotation in either system.
Example
use uvoxid::UvoxId;
use uvoxxyz::types::{CoordSystem, Cartesian, Quaternion};
use uvoxxyz::convert::*;
fn main() {
// A UvoxId located at radius=1m, lat=0, lon=0
let id = UvoxId::new(0, 1_000_000, 0, 0);
// Convert to Cartesian (math convention)
let cart = id.to_cartesian(CoordSystem::Math);
println!("Cartesian: ({}, {}, {})", cart.x, cart.y, cart.z);
// Rotate by 90° around Z
let q = Quaternion::from_axis_angle(
Cartesian { x: 0.0, y: 0.0, z: 1.0 },
std::f64::consts::FRAC_PI_2
);
let rotated = q.rotate(cart);
println!("Rotated: ({}, {}, {})", rotated.x, rotated.y, rotated.z);
// Convert back to UvoxId
let round_trip = UvoxId::from_cartesian(rotated, CoordSystem::Math, 0);
println!("Back to UvoxId: {}", round_trip);
}
Features
- 🧭
UvoxId → Cartesianand back - 🔄 Support for math and graphics axis conventions
- 🎛️ Quaternion math (normalize, multiply, rotate)
- ⚡ Nanosecond-level benchmarks (sub-20ns conversions)
Related Crates
uvoxid: Hierarchical spherical integer coordinate systemgeospec: Geometric shapes and inference utilities
License
MIT or Apache-2.0, at your option.
Minimum Rust Version
Rust 1.70+
Dependencies
~8MB
~219K SLoC