Fri, 28 Mar 2025 08:36:08 -0500
Add auxiliary results
13 | 1 | /*! |
2 | Abstract traits for manifolds. | |
3 | */ | |
5 | 4 | |
37
d7cd14b8ccc0
Basic cylinder implementation
Tuomo Valkonen <tuomov@iki.fi>
parents:
13
diff
changeset
|
5 | use serde::Serialize; |
5 | 6 | use alg_tools::euclidean::Euclidean; |
56 | 7 | use alg_tools::instance::{Space, BasicDecomposition}; |
0 | 8 | |
9 | /// A point on a manifold | |
56 | 10 | pub trait ManifoldPoint : Space<Decomp=BasicDecomposition> + Clone + PartialEq { |
0 | 11 | // Type of tangent factors |
37
d7cd14b8ccc0
Basic cylinder implementation
Tuomo Valkonen <tuomov@iki.fi>
parents:
13
diff
changeset
|
12 | type Tangent : Euclidean<f64, Output=Self::Tangent> + std::fmt::Debug + Serialize; |
0 | 13 | |
14 | /// Exponential map | |
8 | 15 | fn exp(self, tangent : &Self::Tangent) -> Self; |
0 | 16 | |
17 | /// Logarithmic map | |
18 | fn log(&self, other : &Self) -> Self::Tangent; | |
5 | 19 | |
20 | /// Distance to `other` | |
21 | fn dist_to(&self, other : &Self) -> f64; | |
6
df9628092285
Add a zero function on manifolds
Tuomo Valkonen <tuomov@iki.fi>
parents:
5
diff
changeset
|
22 | |
df9628092285
Add a zero function on manifolds
Tuomo Valkonen <tuomov@iki.fi>
parents:
5
diff
changeset
|
23 | /// Return the zero tangent at `self`. |
df9628092285
Add a zero function on manifolds
Tuomo Valkonen <tuomov@iki.fi>
parents:
5
diff
changeset
|
24 | fn tangent_origin(&self) -> Self::Tangent; |
0 | 25 | } |
5 | 26 | |
7 | 27 | /// Point on a manifold that possesses displayable embedded coordinates. |
28 | pub trait EmbeddedManifoldPoint : ManifoldPoint + std::fmt::Debug { | |
37
d7cd14b8ccc0
Basic cylinder implementation
Tuomo Valkonen <tuomov@iki.fi>
parents:
13
diff
changeset
|
29 | type EmbeddedCoords : std::fmt::Display + Serialize; |
7 | 30 | |
31 | /// Convert a point on a manifold into embedded coordinates | |
32 | fn embedded_coords(&self) -> Self::EmbeddedCoords; | |
33 | } | |
37
d7cd14b8ccc0
Basic cylinder implementation
Tuomo Valkonen <tuomov@iki.fi>
parents:
13
diff
changeset
|
34 | |
d7cd14b8ccc0
Basic cylinder implementation
Tuomo Valkonen <tuomov@iki.fi>
parents:
13
diff
changeset
|
35 | /// Point on a manifold that possesses faces |
d7cd14b8ccc0
Basic cylinder implementation
Tuomo Valkonen <tuomov@iki.fi>
parents:
13
diff
changeset
|
36 | pub trait FacedManifoldPoint : ManifoldPoint + std::fmt::Debug { |
d7cd14b8ccc0
Basic cylinder implementation
Tuomo Valkonen <tuomov@iki.fi>
parents:
13
diff
changeset
|
37 | type Face : std::fmt::Display + Serialize; |
d7cd14b8ccc0
Basic cylinder implementation
Tuomo Valkonen <tuomov@iki.fi>
parents:
13
diff
changeset
|
38 | |
d7cd14b8ccc0
Basic cylinder implementation
Tuomo Valkonen <tuomov@iki.fi>
parents:
13
diff
changeset
|
39 | /// Convert a point on a manifold into embedded coordinates |
d7cd14b8ccc0
Basic cylinder implementation
Tuomo Valkonen <tuomov@iki.fi>
parents:
13
diff
changeset
|
40 | fn face(&self) -> Self::Face; |
d7cd14b8ccc0
Basic cylinder implementation
Tuomo Valkonen <tuomov@iki.fi>
parents:
13
diff
changeset
|
41 | } |