pub struct Coordinate5D {
pub x: f32,
pub y: f32,
pub z: f32,
pub w: f32,
pub v: f32,
}Expand description
5D holographic coordinate for spatial memory indexing.
Ported from v2’s Rust implementation. Each dimension is normalized
to [0.0, 1.0] and derived deterministically from content via
Coordinate5D::encode(text).
- x: semantic axis (content hash byte 0-3)
- y: semantic axis (content hash byte 4-7)
- z: semantic axis (content hash byte 8-11)
- w: temporal weight (recency-based)
- v: consciousness resonance (importance-based)
Fields§
§x: f32Semantic axis X (content-derived)
y: f32Semantic axis Y (content-derived)
z: f32Semantic axis Z (content-derived)
w: f32Temporal weight (0 = old, 1 = recent)
v: f32Consciousness resonance (0 = low importance, 1 = high)
Implementations§
Source§impl Coordinate5D
impl Coordinate5D
Sourcepub const fn new(x: f32, y: f32, z: f32, w: f32, v: f32) -> Self
pub const fn new(x: f32, y: f32, z: f32, w: f32, v: f32) -> Self
Create a coordinate from explicit values.
Sourcepub fn encode(text: &str) -> Self
pub fn encode(text: &str) -> Self
Deterministically encode text content into a 5D coordinate.
Uses SHA-256 of the text to derive x, y, z dimensions. The w (temporal) and v (consciousness) dimensions default to 0.5 and should be updated when the memory is created with actual temporal and importance data.
Sourcepub const fn from_semantic(
x: f32,
y: f32,
z: f32,
temporal_weight: f32,
importance: f32,
) -> Self
pub const fn from_semantic( x: f32, y: f32, z: f32, temporal_weight: f32, importance: f32, ) -> Self
Create a coordinate from pre-computed semantic scores.
Unlike encode() which uses SHA-256 hash bytes (semantically meaningless),
this constructor accepts x/y/z values derived from semantic analysis of
the content (e.g., TF-IDF anchor projection). This enables similar content
to produce similar coordinates.
Sourcepub fn encode_with_context(
text: &str,
temporal_weight: f32,
importance: f32,
) -> Self
pub fn encode_with_context( text: &str, temporal_weight: f32, importance: f32, ) -> Self
Encode text with temporal and importance context.
Sourcepub fn distance_to(&self, other: &Self) -> f32
pub fn distance_to(&self, other: &Self) -> f32
Euclidean distance in 5D space.
Sourcepub fn semantic_distance_to(&self, other: &Self) -> f32
pub fn semantic_distance_to(&self, other: &Self) -> f32
Weighted distance — emphasizes semantic dimensions (x, y, z) over temporal (w) and consciousness (v).
Sourcepub fn zone(&self) -> Zone
pub fn zone(&self) -> Zone
Which zone this coordinate falls into, based on radial distance from the center (0.5, 0.5, 0.5, 0.5, 0.5).
Sourcepub fn encode_key(&self) -> Vec<u8> ⓘ
pub fn encode_key(&self) -> Vec<u8> ⓘ
Encode as a sortable composite key for LMDB (20 bytes).
Sourcepub const fn decode_key(key: &[u8]) -> Option<Self>
pub const fn decode_key(key: &[u8]) -> Option<Self>
Decode from a composite key.