Expand description
Monomorphic $n$-gon.
NGon
represents a polygonal structure as an array. Each array element
represents vertex data in order with adjacent elements being connected by an
implicit undirected edge. For example, an NGon
with three vertices
(NGon<_, 3>
) would represent a trigon (triangle). Generally these elements
are labeled $A$, $B$, $C$, etc. Note that the constant parameter N
represents the number of the NGon
’s vertices and not the number of its
edges (arity).
NGon
s with less than three vertices are a degenerate case. An NGon
with
two vertices (NGon<_, 2>
) is considered a monogon and is used to
represent edges. Such an NGon
is not considered a digon, as it
represents a single undirected edge rather than two distinct (but collapsed)
edges. Note that the polygonal types BoundedPolygon
and
UnboundedPolygon
never represent edges. See the Edge
type
definition.
NGon
s with one or zero vertices are unsupported and lack various trait
implementations.
See the module documentation for more information.
Tuple Fields
0: [G; N]
Implementations
sourceimpl<G, const N: usize> NGon<G, N>
impl<G, const N: usize> NGon<G, N>
pub fn into_array(self) -> [G; N]
pub fn positions(&self) -> NGon<&Position<G>, N> where
G: AsPosition,
sourceimpl<G> NGon<G, 2_usize>
impl<G> NGon<G, 2_usize>
pub fn new(a: G, b: G) -> Self
pub fn line(&self) -> Option<Line<Position<G>>> where
G: AsPosition,
pub fn is_bisected(&self, other: &Self) -> bool where
G: AsPosition,
Position<G>: FiniteDimensional<N = U2>,
Trait Implementations
sourceimpl<G, const N: usize> DynamicArity for NGon<G, N> where
Constant<N>: ToType,
TypeOf<N>: Cmp<U1, Output = Greater>,
impl<G, const N: usize> DynamicArity for NGon<G, N> where
Constant<N>: ToType,
TypeOf<N>: Cmp<U1, Output = Greater>,
sourceimpl<G, const N: usize> Fold for NGon<G, N> where
Self: Topological,
impl<G, const N: usize> Fold for NGon<G, N> where
Self: Topological,
fn fold<U, F>(self, seed: U, f: F) -> U where
F: FnMut(U, Self::Item) -> U,
fn sum(self) -> Self::Item where
Self::Item: Add<Self::Item>,
Self::Item: Zero,
<Self::Item as Add<Self::Item>>::Output == Self::Item,
fn product(self) -> Self::Item where
Self::Item: Mul<Self::Item>,
Self::Item: One,
<Self::Item as Mul<Self::Item>>::Output == Self::Item,
fn min_or_undefined(self) -> Self::Item where
Self::Item: Bounded,
Self::Item: IntrinsicOrd,
fn max_or_undefined(self) -> Self::Item where
Self::Item: Bounded,
Self::Item: IntrinsicOrd,
fn any<F>(self, f: F) -> bool where
F: FnMut(Self::Item) -> bool,
fn all<F>(self, f: F) -> bool where
F: FnMut(Self::Item) -> bool,
sourceimpl<G> From<NGon<G, 3_usize>> for BoundedPolygon<G>
impl<G> From<NGon<G, 3_usize>> for BoundedPolygon<G>
sourceimpl<G> From<NGon<G, 4_usize>> for BoundedPolygon<G>
impl<G> From<NGon<G, 4_usize>> for BoundedPolygon<G>
sourceimpl<G, const N: usize> From<NGon<G, N>> for UnboundedPolygon<G> where
Constant<N>: ToType,
TypeOf<N>: Cmp<U2, Output = Greater>,
G: Clone,
impl<G, const N: usize> From<NGon<G, N>> for UnboundedPolygon<G> where
Constant<N>: ToType,
TypeOf<N>: Cmp<U2, Output = Greater>,
G: Clone,
sourceimpl<G, const N: usize> FromItems for NGon<G, N>
impl<G, const N: usize> FromItems for NGon<G, N>
fn from_items<I>(items: I) -> Option<Self> where
I: IntoIterator<Item = Self::Item>,
sourceimpl<T> Intersection<NGon<T, 2_usize>> for Edge<T> where
T: AsPosition,
Position<T>: FiniteDimensional<N = U2>,
impl<T> Intersection<NGon<T, 2_usize>> for Edge<T> where
T: AsPosition,
Position<T>: FiniteDimensional<N = U2>,
type Output = EdgeEdge<<T as AsPosition>::Position>
fn intersection(&self, other: &Edge<T>) -> Option<Self::Output>
sourceimpl<G, const N: usize> IntoEdges for NGon<G, N> where
G: Clone,
Constant<N>: ToType,
TypeOf<N>: Cmp<U1, Output = Greater>,
impl<G, const N: usize> IntoEdges for NGon<G, N> where
G: Clone,
Constant<N>: ToType,
TypeOf<N>: Cmp<U1, Output = Greater>,
type Output = Vec<NGon<<NGon<G, N> as Topological>::Vertex, 2_usize>, Global>
fn into_edges(self) -> Self::Output
sourceimpl<G, const N: usize> IntoItems for NGon<G, N>
impl<G, const N: usize> IntoItems for NGon<G, N>
type Output = <NGon<G, N> as IntoIterator>::IntoIter
fn into_items(self) -> Self::Output
sourceimpl<G, const N: usize> IntoIterator for NGon<G, N>
impl<G, const N: usize> IntoIterator for NGon<G, N>
sourceimpl<G, const N: usize> Polygonal for NGon<G, N> where
Self: Topological,
Constant<N>: ToType,
TypeOf<N>: Cmp<U2, Output = Greater>,
impl<G, const N: usize> Polygonal for NGon<G, N> where
Self: Topological,
Constant<N>: ToType,
TypeOf<N>: Cmp<U2, Output = Greater>,
sourcefn is_convex(&self) -> bool where
Self::Vertex: AsPosition,
Position<Self::Vertex>: EuclideanSpace + FiniteDimensional<N = U2>,
fn is_convex(&self) -> bool where
Self::Vertex: AsPosition,
Position<Self::Vertex>: EuclideanSpace + FiniteDimensional<N = U2>,
Determines if the polygon is convex. Read more
sourceimpl<G, const N: usize> StaticArity for NGon<G, N> where
Constant<N>: ToType,
TypeOf<N>: Cmp<U1, Output = Greater>,
impl<G, const N: usize> StaticArity for NGon<G, N> where
Constant<N>: ToType,
TypeOf<N>: Cmp<U1, Output = Greater>,
sourceimpl<G, const N: usize> Topological for NGon<G, N> where
Constant<N>: ToType,
TypeOf<N>: Cmp<U1, Output = Greater>,
impl<G, const N: usize> Topological for NGon<G, N> where
Constant<N>: ToType,
TypeOf<N>: Cmp<U1, Output = Greater>,
type Vertex = G
fn try_from_slice<I>(vertices: I) -> Option<Self> where
Self::Vertex: Copy,
I: AsRef<[Self::Vertex]>,
sourcefn 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$. Read more
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,
sourcefn 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$. Read more
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,
sourcefn 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. Read more
fn edges(&self) -> Vec<Edge<&Self::Vertex>>
sourceimpl<G, const N: usize> TryFromIterator<G> for NGon<G, N>
impl<G, const N: usize> TryFromIterator<G> for NGon<G, N>
sourceimpl<G, H, const N: usize> ZipMap<H> for NGon<G, N>
impl<G, H, const N: usize> ZipMap<H> for NGon<G, N>
type Output = NGon<H, N>
fn zip_map<F>(self, other: Self, f: F) -> Self::Output where
F: FnMut(Self::Item, Self::Item) -> H,
fn per_item_sum(self, other: Self) -> Self::Output where
Self: Adjunct<Item = T>,
T: Add<T, Output = T>,
fn per_item_product(self, other: Self) -> Self::Output where
Self: Adjunct<Item = T>,
T: Mul<T, Output = T>,
fn per_item_min_or_undefined(self, other: Self) -> Self::Output where
Self: Adjunct<Item = T>,
T: IntrinsicOrd,
fn per_item_max_or_undefined(self, other: Self) -> Self::Output where
Self: Adjunct<Item = T>,
T: IntrinsicOrd,
impl<G: Copy, const N: usize> Copy for NGon<G, N>
impl<G, const N: usize> Monomorphic for NGon<G, N> where
Constant<N>: ToType,
TypeOf<N>: Cmp<U1, Output = Greater>,
impl<G, const N: usize> StructuralPartialEq for NGon<G, N>
Auto Trait Implementations
impl<G, const N: usize> RefUnwindSafe for NGon<G, N> where
G: RefUnwindSafe,
impl<G, const N: usize> Send for NGon<G, N> where
G: Send,
impl<G, const N: usize> Sync for NGon<G, N> where
G: Sync,
impl<G, const N: usize> Unpin for NGon<G, N> where
G: Unpin,
impl<G, const N: usize> UnwindSafe for NGon<G, N> where
G: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> FromGeometry<T> for T
impl<T> FromGeometry<T> for T
fn from_geometry(other: T) -> T
sourceimpl<T, U> IntoGeometry<U> for T where
U: FromGeometry<T>,
impl<T, U> IntoGeometry<U> for T where
U: FromGeometry<T>,
fn into_geometry(self) -> U
sourceimpl<N, P, Q> IntoIndexed<N> for P where
P: Map<(N, <P as Topological>::Vertex), Output = Q> + Polygonal,
Q: Polygonal<Vertex = (N, <P as Topological>::Vertex)>,
N: Copy + Integer + Unsigned,
impl<N, P, Q> IntoIndexed<N> for P where
P: Map<(N, <P as Topological>::Vertex), Output = Q> + Polygonal,
Q: Polygonal<Vertex = (N, <P as Topological>::Vertex)>,
N: Copy + Integer + Unsigned,
type Indexed = Q
fn into_indexed(self) -> <P as IntoIndexed<N>>::Indexed
sourceimpl<T> IntoVertices for T where
T: Topological,
impl<T> IntoVertices for T where
T: Topological,
type Output = <T as IntoIterator>::IntoIter
fn into_vertices(self) -> <T as IntoVertices>::Output
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct self
from the equivalent element of its
superset. Read more
fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if self
is actually part of its subset T
(and can be converted to it).
fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as self.to_subset
but without any property checks. Always succeeds.
fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts self
to the equivalent element of its superset.