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

pub trait Topological: AsMut<[Self::Item]> + AsRef<[Self::Item]> + Composite<Item = Self::Vertex> + Sized + IntoIterator<Item = Self::Item> + Sized {
    type Vertex;
    fn arity(&self) -> usize;

    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> + Push<Output = 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> + Push<Output = 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> + Push<Output = 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> + Push<Output = 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: AsPosition,
        Position<Self::Vertex>: EuclideanSpace + FiniteDimensional,
        <Position<Self::Vertex> as FiniteDimensional>::N: Cmp<U2, Output = Greater>
, { ... } }

Associated Types

type Vertex

Loading content...

Required methods

fn arity(&self) -> usize

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> + Push<Output = 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> + Push<Output = 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> + Push<Output = 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::primitive::{Topological, Trigon};
use theon::query::{Plane, Unit};
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> + Push<Output = 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: AsPosition,
    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.

Loading content...

Implementors

impl<T> Topological for Polygon<T>[src]

type Vertex = T

impl<T> Topological for NGon<[T; 2]>[src]

type Vertex = T

impl<T> Topological for NGon<[T; 3]>[src]

type Vertex = T

impl<T> Topological for NGon<[T; 4]>[src]

type Vertex = T

impl<T> Topological for NGon<[T; 5]>[src]

type Vertex = T

impl<T> Topological for NGon<[T; 6]>[src]

type Vertex = T

impl<T> Topological for NGon<[T; 7]>[src]

type Vertex = T

impl<T> Topological for NGon<[T; 8]>[src]

type Vertex = T

impl<T> Topological for NGon<[T; 9]>[src]

type Vertex = T

impl<T> Topological for NGon<[T; 10]>[src]

type Vertex = T

impl<T> Topological for NGon<[T; 11]>[src]

type Vertex = T

impl<T> Topological for NGon<[T; 12]>[src]

type Vertex = T

Loading content...