Fri, 06 Dec 2024 14:27:14 -0500
Adjust plot style
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; |
0 | 7 | |
8 | /// A point on a manifold | |
9 | pub trait ManifoldPoint : Clone + PartialEq { | |
10 | // Type of tangent factors | |
37
d7cd14b8ccc0
Basic cylinder implementation
Tuomo Valkonen <tuomov@iki.fi>
parents:
13
diff
changeset
|
11 | type Tangent : Euclidean<f64, Output=Self::Tangent> + std::fmt::Debug + Serialize; |
0 | 12 | |
13 | /// Exponential map | |
8 | 14 | fn exp(self, tangent : &Self::Tangent) -> Self; |
0 | 15 | |
16 | /// Logarithmic map | |
17 | fn log(&self, other : &Self) -> Self::Tangent; | |
5 | 18 | |
19 | /// Distance to `other` | |
20 | fn dist_to(&self, other : &Self) -> f64; | |
6
df9628092285
Add a zero function on manifolds
Tuomo Valkonen <tuomov@iki.fi>
parents:
5
diff
changeset
|
21 | |
df9628092285
Add a zero function on manifolds
Tuomo Valkonen <tuomov@iki.fi>
parents:
5
diff
changeset
|
22 | /// Return the zero tangent at `self`. |
df9628092285
Add a zero function on manifolds
Tuomo Valkonen <tuomov@iki.fi>
parents:
5
diff
changeset
|
23 | fn tangent_origin(&self) -> Self::Tangent; |
0 | 24 | } |
5 | 25 | |
7 | 26 | /// Point on a manifold that possesses displayable embedded coordinates. |
27 | pub trait EmbeddedManifoldPoint : ManifoldPoint + std::fmt::Debug { | |
37
d7cd14b8ccc0
Basic cylinder implementation
Tuomo Valkonen <tuomov@iki.fi>
parents:
13
diff
changeset
|
28 | type EmbeddedCoords : std::fmt::Display + Serialize; |
7 | 29 | |
30 | /// Convert a point on a manifold into embedded coordinates | |
31 | fn embedded_coords(&self) -> Self::EmbeddedCoords; | |
32 | } | |
37
d7cd14b8ccc0
Basic cylinder implementation
Tuomo Valkonen <tuomov@iki.fi>
parents:
13
diff
changeset
|
33 | |
d7cd14b8ccc0
Basic cylinder implementation
Tuomo Valkonen <tuomov@iki.fi>
parents:
13
diff
changeset
|
34 | /// Point on a manifold that possesses faces |
d7cd14b8ccc0
Basic cylinder implementation
Tuomo Valkonen <tuomov@iki.fi>
parents:
13
diff
changeset
|
35 | pub trait FacedManifoldPoint : ManifoldPoint + std::fmt::Debug { |
d7cd14b8ccc0
Basic cylinder implementation
Tuomo Valkonen <tuomov@iki.fi>
parents:
13
diff
changeset
|
36 | type Face : std::fmt::Display + Serialize; |
d7cd14b8ccc0
Basic cylinder implementation
Tuomo Valkonen <tuomov@iki.fi>
parents:
13
diff
changeset
|
37 | |
d7cd14b8ccc0
Basic cylinder implementation
Tuomo Valkonen <tuomov@iki.fi>
parents:
13
diff
changeset
|
38 | /// Convert a point on a manifold into embedded coordinates |
d7cd14b8ccc0
Basic cylinder implementation
Tuomo Valkonen <tuomov@iki.fi>
parents:
13
diff
changeset
|
39 | fn face(&self) -> Self::Face; |
d7cd14b8ccc0
Basic cylinder implementation
Tuomo Valkonen <tuomov@iki.fi>
parents:
13
diff
changeset
|
40 | } |