1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/*
* SPDX-License-Identifier: MIT
* Copyright (c) 2023 - 2026. The DeepCausality Authors and Contributors. All Rights Reserved.
*/
use crateIndexError;
/// Provides a generalized interface for N-dimensional coordinate access.
///
/// This trait is agnostic to geometry and is designed to support
/// both standard (Cartesian) coordinates and abstract representations such as:
/// - Curved spacetime manifolds
/// - Quaternionic rotations
/// - Symbolic embeddings (e.g., logical coordinates)
///
/// The trait provides only **index-based access** and leaves axis naming,
/// scaling, or metric behavior to higher-level abstractions.
///
/// # Example
/// ```
/// use deep_causality::{Coordinate, IndexError};
///
/// struct Vec3D {
/// x: f64,
/// y: f64,
/// z: f64,
/// }
///
/// impl Coordinate<f64> for Vec3D {
/// fn dimension(&self) -> usize {
/// 3
/// }
///
/// fn coordinate(&self, index: usize) -> Result<&f64, IndexError> {
/// match index {
/// 0 => Ok(&self.x),
/// 1 => Ok(&self.y),
/// 2 => Ok(&self.z),
/// _ => Err(IndexError("Index out of bounds".to_string())),
/// }
/// }
/// }
/// ```