src/manifold.rs

Sat, 07 Dec 2024 14:04:26 -0500

author
Tuomo Valkonen <tuomov@iki.fi>
date
Sat, 07 Dec 2024 14:04:26 -0500
changeset 62
6d9de6d05ef7
parent 56
34f8ec636368
permissions
-rw-r--r--

Zenodo packaging hacks

/*!
Abstract traits for manifolds.
*/

use serde::Serialize;
use alg_tools::euclidean::Euclidean;
use alg_tools::instance::{Space, BasicDecomposition};

/// A point on a manifold
pub trait ManifoldPoint : Space<Decomp=BasicDecomposition> + Clone + PartialEq {
    // Type of tangent factors
    type Tangent : Euclidean<f64, Output=Self::Tangent> + std::fmt::Debug + Serialize;

    /// Exponential map
    fn exp(self, tangent : &Self::Tangent) -> Self;

    /// Logarithmic map
    fn log(&self, other : &Self) -> Self::Tangent;

    /// Distance to `other`
    fn dist_to(&self, other : &Self) -> f64;

    /// Return the zero tangent at `self`.
    fn tangent_origin(&self) -> Self::Tangent;
}

/// Point on a manifold that possesses displayable embedded coordinates.
pub trait EmbeddedManifoldPoint : ManifoldPoint + std::fmt::Debug {
    type EmbeddedCoords : std::fmt::Display + Serialize;

    /// Convert a point on a manifold into embedded coordinates
    fn embedded_coords(&self) -> Self::EmbeddedCoords;
}

/// Point on a manifold that possesses faces
pub trait FacedManifoldPoint : ManifoldPoint + std::fmt::Debug {
    type Face : std::fmt::Display + Serialize;

    /// Convert a point on a manifold into embedded coordinates
    fn face(&self) -> Self::Face;
}

mercurial