Trait plexus::primitive::Topological[][src]

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>> { ... } }

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.

Associated Types

type Vertex[src]

Loading content...

Required methods

fn try_from_slice<T>(vertices: T) -> Option<Self> where
    Self::Vertex: Copy,
    T: AsRef<[Self::Vertex]>, 
[src]

Loading content...

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>>, 
[src]

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
[src]

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>>, 
[src]

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
[src]

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>, 
[src]

Projects an $n$-gon into a plane.

The positions in each vertex of the $n$-gon are translated along the normal of the plane.

fn edges(&self) -> Vec<Edge<&Self::Vertex>>[src]

Loading content...

Implementors

impl<G> Topological for BoundedPolygon<G>[src]

type Vertex = G

fn try_from_slice<I>(vertices: I) -> Option<Self> where
    Self::Vertex: Copy,
    I: AsRef<[Self::Vertex]>, 
[src]

impl<G> Topological for UnboundedPolygon<G>[src]

type Vertex = G

fn try_from_slice<I>(vertices: I) -> Option<Self> where
    Self::Vertex: Copy,
    I: AsRef<[Self::Vertex]>, 
[src]

impl<G, const N: usize> Topological for NGon<G, N> where
    Constant<N>: ToType,
    TypeOf<N>: Cmp<U1, Output = Greater>, 
[src]

type Vertex = G

fn try_from_slice<I>(vertices: I) -> Option<Self> where
    Self::Vertex: Copy,
    I: AsRef<[Self::Vertex]>, 
[src]

Loading content...