1 /*! |
1 /*! |
2 Abstract traits for manifolds. |
2 Abstract traits for manifolds. |
3 */ |
3 */ |
4 |
4 |
|
5 use serde::Serialize; |
5 use alg_tools::euclidean::Euclidean; |
6 use alg_tools::euclidean::Euclidean; |
6 |
7 |
7 /// A point on a manifold |
8 /// A point on a manifold |
8 pub trait ManifoldPoint : Clone + PartialEq { |
9 pub trait ManifoldPoint : Clone + PartialEq { |
9 // Type of tangent factors |
10 // Type of tangent factors |
10 type Tangent : Euclidean<f64, Output=Self::Tangent> + std::fmt::Debug; |
11 type Tangent : Euclidean<f64, Output=Self::Tangent> + std::fmt::Debug + Serialize; |
11 |
12 |
12 /// Exponential map |
13 /// Exponential map |
13 fn exp(self, tangent : &Self::Tangent) -> Self; |
14 fn exp(self, tangent : &Self::Tangent) -> Self; |
14 |
15 |
15 /// Logarithmic map |
16 /// Logarithmic map |
22 fn tangent_origin(&self) -> Self::Tangent; |
23 fn tangent_origin(&self) -> Self::Tangent; |
23 } |
24 } |
24 |
25 |
25 /// Point on a manifold that possesses displayable embedded coordinates. |
26 /// Point on a manifold that possesses displayable embedded coordinates. |
26 pub trait EmbeddedManifoldPoint : ManifoldPoint + std::fmt::Debug { |
27 pub trait EmbeddedManifoldPoint : ManifoldPoint + std::fmt::Debug { |
27 type EmbeddedCoords : std::fmt::Display; |
28 type EmbeddedCoords : std::fmt::Display + Serialize; |
28 |
29 |
29 /// Convert a point on a manifold into embedded coordinates |
30 /// Convert a point on a manifold into embedded coordinates |
30 fn embedded_coords(&self) -> Self::EmbeddedCoords; |
31 fn embedded_coords(&self) -> Self::EmbeddedCoords; |
31 } |
32 } |
|
33 |
|
34 /// Point on a manifold that possesses faces |
|
35 pub trait FacedManifoldPoint : ManifoldPoint + std::fmt::Debug { |
|
36 type Face : std::fmt::Display + Serialize; |
|
37 |
|
38 /// Convert a point on a manifold into embedded coordinates |
|
39 fn face(&self) -> Self::Face; |
|
40 } |