devela/num/geom/metric/
distance.rs

1// devela::num::geom::metric::distance
2//
3//! Defines [`Distance`].
4//
5
6#[cfg(doc)]
7use crate::{Orientation, Position};
8
9/// A separation between two locations in `D`-dimensional space.
10///
11/// Represents a displacement vector **without an absolute origin**.
12/// It describes the magnitude of separation between positions.
13///
14/// - Unlike [`Position`], `Distance` is **relative**,
15///   and represents how far apart two positions are.
16/// - Unlike [`Orientation`], `Distance` has **magnitude**
17///   but no defined **orientation**.
18#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
19pub struct Distance<T, const D: usize> {
20    /// The component-wise separation in `D`-dimensional space.
21    pub dim: [T; D],
22}