pub struct GalacticAddress {
pub reality_index: u8,
/* private fields */
}Expand description
A packed 48-bit galactic coordinate plus a galaxy (reality) index.
The 48-bit value encodes fields in portal glyph order: P-SSS-YY-ZZZ-XXX
where P=PlanetIndex, SSS=SolarSystemIndex, YY=VoxelY, ZZZ=VoxelZ, XXX=VoxelX.
The reality_index identifies the galaxy (0=Euclid, 1=Hilbert, etc.) and is
stored separately from the packed value.
Fields§
§reality_index: u8Implementations§
Source§impl GalacticAddress
impl GalacticAddress
Sourcepub fn new(
voxel_x: i16,
voxel_y: i8,
voxel_z: i16,
solar_system_index: u16,
planet_index: u8,
reality_index: u8,
) -> Self
pub fn new( voxel_x: i16, voxel_y: i8, voxel_z: i16, solar_system_index: u16, planet_index: u8, reality_index: u8, ) -> Self
Create from individual field values (portal coordinate frame).
Sourcepub fn from_packed(packed: u64, reality_index: u8) -> Self
pub fn from_packed(packed: u64, reality_index: u8) -> Self
Create from raw packed 48-bit value and reality index.
Sourcepub fn planet_index(&self) -> u8
pub fn planet_index(&self) -> u8
Planet index (4-bit unsigned, 0-15). Bits 47-44.
Sourcepub fn solar_system_index(&self) -> u16
pub fn solar_system_index(&self) -> u16
Solar system index (12-bit unsigned, 0x000-0xFFE). Bits 43-32.
Sourcepub fn voxel_position(&self) -> (i16, i8, i16)
pub fn voxel_position(&self) -> (i16, i8, i16)
Voxel coordinates as (x, y, z) signed integers (center-origin).
Sourcepub fn from_signal_booster(
s: &str,
planet_index: u8,
reality_index: u8,
) -> Result<Self, AddressParseError>
pub fn from_signal_booster( s: &str, planet_index: u8, reality_index: u8, ) -> Result<Self, AddressParseError>
Parse signal booster format XXXX:YYYY:ZZZZ:SSSS.
Signal booster uses corner-origin unsigned coordinates. The conversion adds fixed offsets to translate into portal-frame (center-origin) values. Does NOT include planet index or reality index; caller must supply those.
Sourcepub fn to_signal_booster(&self) -> String
pub fn to_signal_booster(&self) -> String
Format as signal booster string XXXX:YYYY:ZZZZ:SSSS.
Converts portal-frame (center-origin) coordinates back to the corner-origin unsigned format used by the in-game signal booster.
Sourcepub fn distance_ly(&self, other: &GalacticAddress) -> f64
pub fn distance_ly(&self, other: &GalacticAddress) -> f64
Distance in light-years to another address.
Uses Euclidean distance in voxel space multiplied by 400. Only meaningful for addresses in the same galaxy.
Sourcepub fn same_region(&self, other: &GalacticAddress) -> bool
pub fn same_region(&self, other: &GalacticAddress) -> bool
Whether two addresses are in the same region (same VoxelX/Y/Z).
Sourcepub fn same_system(&self, other: &GalacticAddress) -> bool
pub fn same_system(&self, other: &GalacticAddress) -> bool
Whether two addresses are in the same system (same region + same SSI).
Sourcepub fn within(&self, other: &GalacticAddress, ly: f64) -> bool
pub fn within(&self, other: &GalacticAddress, ly: f64) -> bool
Whether another address is within N light-years.
Sourcepub fn distance_to_core_ly(&self) -> f64
pub fn distance_to_core_ly(&self) -> f64
Distance in light-years from this address to the galactic core (0, 0, 0).
Note: comparing addresses across different galaxies (reality_index) is not physically meaningful.
Sourcepub fn is_black_hole(&self) -> bool
pub fn is_black_hole(&self) -> bool
Whether this address points to a black hole system (SSI 0x079).
Sourcepub fn is_atlas_interface(&self) -> bool
pub fn is_atlas_interface(&self) -> bool
Whether this address points to an Atlas Interface system (SSI 0x07A).
Sourcepub fn is_purple_system(&self) -> bool
pub fn is_purple_system(&self) -> bool
Whether this address is in the purple system SSI range (0x3E8-0x429).
Source§impl GalacticAddress
impl GalacticAddress
Sourcepub fn to_portal_address(&self) -> PortalAddress
pub fn to_portal_address(&self) -> PortalAddress
Convert to PortalAddress.
Sourcepub fn from_portal_string(s: &str) -> Result<Self, PortalParseError>
pub fn from_portal_string(s: &str) -> Result<Self, PortalParseError>
Create from a portal address string (hex, emoji, or mixed). Reality index defaults to 0.
Trait Implementations§
Source§impl Clone for GalacticAddress
impl Clone for GalacticAddress
Source§fn clone(&self) -> GalacticAddress
fn clone(&self) -> GalacticAddress
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for GalacticAddress
impl Debug for GalacticAddress
Source§impl<'de> Deserialize<'de> for GalacticAddress
impl<'de> Deserialize<'de> for GalacticAddress
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Display for GalacticAddress
Display as 0x followed by 12 uppercase hex digits.
impl Display for GalacticAddress
Display as 0x followed by 12 uppercase hex digits.
Source§impl From<GalacticAddress> for PortalAddress
impl From<GalacticAddress> for PortalAddress
Source§fn from(addr: GalacticAddress) -> Self
fn from(addr: GalacticAddress) -> Self
Convert galactic address to portal address.
Extracts each nibble from the packed 48-bit value.
Source§impl From<GalacticAddress> for u64
Into raw packed u64 (drops reality_index).
impl From<GalacticAddress> for u64
Into raw packed u64 (drops reality_index).
Source§fn from(addr: GalacticAddress) -> u64
fn from(addr: GalacticAddress) -> u64
Source§impl From<PortalAddress> for GalacticAddress
impl From<PortalAddress> for GalacticAddress
Source§fn from(pa: PortalAddress) -> Self
fn from(pa: PortalAddress) -> Self
Convert portal address to galactic address.
Portal glyph layout: P-SSS-YY-ZZZ-XXX
(glyph positions 0-indexed: [0]=P, [1-3]=SSS, [4-5]=YY, [6-8]=ZZZ, [9-11]=XXX).
Reality index defaults to 0.
Source§impl From<u64> for GalacticAddress
From raw packed u64 (reality_index defaults to 0).
impl From<u64> for GalacticAddress
From raw packed u64 (reality_index defaults to 0).
Source§impl FromStr for GalacticAddress
Parse from 0x/0X prefix + 12 hex digits, or bare 12 hex digits.
Reality index defaults to 0.
impl FromStr for GalacticAddress
Parse from 0x/0X prefix + 12 hex digits, or bare 12 hex digits.
Reality index defaults to 0.