Trait plexus::primitive::Topological
source · [−]pub trait Topological: Adjunct<Item = Self::Vertex> + AsMut<[Self::Vertex]> + AsRef<[Self::Vertex]> + DynamicArity<Dynamic = usize> + IntoIterator<Item = Self::Vertex> + Sized {
type Vertex;
fn try_from_slice<T>(vertices: T) -> Option<Self>
where
Self::Vertex: Copy,
T: AsRef<[Self::Vertex]>;
fn embed_into_e3_xy<P>(ngon: P, z: Scalar<Self::Vertex>) -> Self
where
Self::Vertex: EuclideanSpace + FiniteDimensional<N = U3>,
P: Map<Self::Vertex, Output = Self> + Topological,
P::Vertex: EuclideanSpace + FiniteDimensional<N = U2> + Extend<Self::Vertex>,
Vector<P::Vertex>: VectorSpace<Scalar = Scalar<Self::Vertex>>,
{ ... }
fn embed_into_e3_xy_with<P, F>(
ngon: P,
z: Scalar<Position<Self::Vertex>>,
f: F
) -> Self
where
Self::Vertex: AsPosition,
Position<Self::Vertex>: EuclideanSpace + FiniteDimensional<N = U3>,
P: Map<Self::Vertex, Output = Self> + Topological,
P::Vertex: EuclideanSpace + FiniteDimensional<N = U2> + Extend<Position<Self::Vertex>>,
Vector<P::Vertex>: VectorSpace<Scalar = Scalar<Position<Self::Vertex>>>,
F: FnMut(Position<Self::Vertex>) -> Self::Vertex,
{ ... }
fn embed_into_e3_plane<P>(ngon: P, plane: Plane<Self::Vertex>) -> Self
where
Self::Vertex: EuclideanSpace + FiniteDimensional<N = U3>,
P: Map<Self::Vertex, Output = Self> + Topological,
P::Vertex: EuclideanSpace + FiniteDimensional<N = U2> + Extend<Self::Vertex>,
Vector<P::Vertex>: VectorSpace<Scalar = Scalar<Self::Vertex>>,
{ ... }
fn embed_into_e3_plane_with<P, F>(
ngon: P,
_: Plane<Position<Self::Vertex>>,
f: F
) -> Self
where
Self::Vertex: AsPosition,
Position<Self::Vertex>: EuclideanSpace + FiniteDimensional<N = U3>,
P: Map<Self::Vertex, Output = Self> + Topological,
P::Vertex: EuclideanSpace + FiniteDimensional<N = U2> + Extend<Position<Self::Vertex>>,
Vector<P::Vertex>: VectorSpace<Scalar = Scalar<Position<Self::Vertex>>>,
F: FnMut(Position<Self::Vertex>) -> Self::Vertex,
{ ... }
fn project_into_plane(self, plane: Plane<Position<Self::Vertex>>) -> Self
where
Self::Vertex: AsPositionMut,
Position<Self::Vertex>: EuclideanSpace + FiniteDimensional,
<Position<Self::Vertex> as FiniteDimensional>::N: Cmp<U2, Output = Greater>,
{ ... }
fn edges(&self) -> Vec<Edge<&Self::Vertex>> { ... }
}
Expand description
Topological structure.
Types implementing Topological
provide some notion of adjacency between
vertices of their Vertex
type. These types typically represent cycle
graphs and polygonal structures, but may also include degenerate forms like
monogons.
Required Associated Types
Required Methods
Provided Methods
fn embed_into_e3_xy<P>(ngon: P, z: Scalar<Self::Vertex>) -> Self where
Self::Vertex: EuclideanSpace + FiniteDimensional<N = U3>,
P: Map<Self::Vertex, Output = Self> + Topological,
P::Vertex: EuclideanSpace + FiniteDimensional<N = U2> + Extend<Self::Vertex>,
Vector<P::Vertex>: VectorSpace<Scalar = Scalar<Self::Vertex>>,
fn embed_into_e3_xy<P>(ngon: P, z: Scalar<Self::Vertex>) -> Self where
Self::Vertex: EuclideanSpace + FiniteDimensional<N = U3>,
P: Map<Self::Vertex, Output = Self> + Topological,
P::Vertex: EuclideanSpace + FiniteDimensional<N = U2> + Extend<Self::Vertex>,
Vector<P::Vertex>: VectorSpace<Scalar = Scalar<Self::Vertex>>,
Embeds an $n$-gon from $\Reals^2$ into $\Reals^3$.
The scalar for the additional basis is normalized to the given value.
Examples
Embedding a triangle into the $xy$-plane at $z=1$:
use nalgebra::Point2;
use plexus::primitive::{Topological, Trigon};
use theon::space::EuclideanSpace;
type E2 = Point2<f64>;
let trigon = Trigon::embed_into_e3_xy(
Trigon::from([
E2::from_xy(-1.0, 0.0),
E2::from_xy(0.0, 1.0),
E2::from_xy(1.0, 0.0),
]),
1.0,
);
fn embed_into_e3_xy_with<P, F>(
ngon: P,
z: Scalar<Position<Self::Vertex>>,
f: F
) -> Self where
Self::Vertex: AsPosition,
Position<Self::Vertex>: EuclideanSpace + FiniteDimensional<N = U3>,
P: Map<Self::Vertex, Output = Self> + Topological,
P::Vertex: EuclideanSpace + FiniteDimensional<N = U2> + Extend<Position<Self::Vertex>>,
Vector<P::Vertex>: VectorSpace<Scalar = Scalar<Position<Self::Vertex>>>,
F: FnMut(Position<Self::Vertex>) -> Self::Vertex,
fn embed_into_e3_plane<P>(ngon: P, plane: Plane<Self::Vertex>) -> Self where
Self::Vertex: EuclideanSpace + FiniteDimensional<N = U3>,
P: Map<Self::Vertex, Output = Self> + Topological,
P::Vertex: EuclideanSpace + FiniteDimensional<N = U2> + Extend<Self::Vertex>,
Vector<P::Vertex>: VectorSpace<Scalar = Scalar<Self::Vertex>>,
fn embed_into_e3_plane<P>(ngon: P, plane: Plane<Self::Vertex>) -> Self where
Self::Vertex: EuclideanSpace + FiniteDimensional<N = U3>,
P: Map<Self::Vertex, Output = Self> + Topological,
P::Vertex: EuclideanSpace + FiniteDimensional<N = U2> + Extend<Self::Vertex>,
Vector<P::Vertex>: VectorSpace<Scalar = Scalar<Self::Vertex>>,
Embeds an $n$-gon from $\Reals^2$ into $\Reals^3$.
The $n$-gon is rotated into the given plane about the origin.
Examples
Embedding a triangle into the $xy$-plane at $z=0$:
use nalgebra::{Point2, Point3};
use plexus::geometry::{Plane, Unit};
use plexus::primitive::{Topological, Trigon};
use theon::space::{Basis, EuclideanSpace};
type E2 = Point2<f64>;
type E3 = Point3<f64>;
let trigon = Trigon::embed_into_e3_plane(
Trigon::from([
E2::from_xy(-1.0, 0.0),
E2::from_xy(0.0, 1.0),
E2::from_xy(1.0, 0.0),
]),
Plane::<E3> {
origin: EuclideanSpace::origin(),
normal: Unit::z(),
},
);
fn embed_into_e3_plane_with<P, F>(
ngon: P,
_: Plane<Position<Self::Vertex>>,
f: F
) -> Self where
Self::Vertex: AsPosition,
Position<Self::Vertex>: EuclideanSpace + FiniteDimensional<N = U3>,
P: Map<Self::Vertex, Output = Self> + Topological,
P::Vertex: EuclideanSpace + FiniteDimensional<N = U2> + Extend<Position<Self::Vertex>>,
Vector<P::Vertex>: VectorSpace<Scalar = Scalar<Position<Self::Vertex>>>,
F: FnMut(Position<Self::Vertex>) -> Self::Vertex,
fn project_into_plane(self, plane: Plane<Position<Self::Vertex>>) -> Self where
Self::Vertex: AsPositionMut,
Position<Self::Vertex>: EuclideanSpace + FiniteDimensional,
<Position<Self::Vertex> as FiniteDimensional>::N: Cmp<U2, Output = Greater>,
fn project_into_plane(self, plane: Plane<Position<Self::Vertex>>) -> Self where
Self::Vertex: AsPositionMut,
Position<Self::Vertex>: EuclideanSpace + FiniteDimensional,
<Position<Self::Vertex> as FiniteDimensional>::N: Cmp<U2, Output = Greater>,
Projects an $n$-gon into a plane.
The positions in each vertex of the $n$-gon are translated along the normal of the plane.