devela 0.29.0

A development substrate of coherence.
Documentation
// devela/src/geom/dir/orientation.rs
//
//! Defines [`Orientation`][1|2|3].
//
// Boundary: Orientation carries direction only.
// It does not carry position, distance, or guaranteed normalization.
//

#[cfg(doc)]
use crate::{Distance, Position};

#[doc = crate::_tags!(geom dir)]
/// A unitless directional vector in `D`-dimensional space.
#[doc = crate::_doc_meta!{
    location("geom/dir", struct Orientation),
    test_size_of(Orientation<f32, 2> = 8|64; niche !Option),
}]
/// Represents **only the direction of movement**, without an absolute
/// reference point or inherent magnitude. It is **typically normalized**
/// to remove scale dependence.
///
/// - Unlike [`Position`], `Orientation` **does not describe a fixed location**.
/// - Unlike [`Distance`], `Orientation` **does not measure separation**.
///
/// This type does **not enforce normalization**, but it is expected
/// to be normalized in most use cases.
///
/// See also: [`Orientation1`], [`Orientation2`], [`Orientation3`], [`ori!`][crate::ori].
#[must_use]
#[repr(transparent)]
pub struct Orientation<T, const D: usize> {
    /// The directional components in `D`-dimensional space.
    pub dim: [T; D],
}

#[doc = crate::_tags!(geom dir)]
/// A 1-dimensional [`Orientation`].
#[doc = crate::_doc_meta!{
    location("geom/dir", type Orientation1),
    test_size_of(Orientation1<f32> = 4|32; niche !Option),
}]
pub type Orientation1<T> = Orientation<T, 1>;

#[doc = crate::_tags!(geom dir)]
/// A 2-dimensional [`Orientation`].
#[doc = crate::_doc_meta!{
    location("geom/dir", type Orientation3),
    test_size_of(Orientation2<f32> = 8|64; niche !Option),
}]
pub type Orientation2<T> = Orientation<T, 2>;

#[doc = crate::_tags!(geom dir)]
/// A 3-dimensional [`Orientation`].
#[doc = crate::_doc_meta!{
    location("geom/dir", type Orientation3),
    test_size_of(Orientation3<f32> = 12|96; niche !Option),
}]
pub type Orientation3<T> = Orientation<T, 3>;

crate::_geom_dim_impl_common![common_methods: Orientation];
crate::_geom_dim_impl_common![common_traits: Orientation];