pub trait PolygonList<'p>: 'p {
type Vertex: Vertex + 'p;
type Index: VertexIndex + 'p;
type IntoItem: Into<PolygonElement<Self::Index>>;
type Iter<'i>: Iterator<Item = Self::IntoItem>
where Self: 'i,
Self::Vertex: 'i,
'p: 'i;
// Required methods
fn vertex_count(&self) -> usize;
fn iter_indices<'i>(&'i self) -> Self::Iter<'i>
where Self: 'i,
Self::Vertex: 'i,
'p: 'i;
fn get_vertex<'a>(&'a self, index: Self::Index) -> &'a Self::Vertex
where 'p: 'a;
// Provided methods
fn index_with<Old: TryInto<New>, New: TryInto<Old>>(
self,
) -> IndexWith<'p, Self, Self::Index, Old, New>
where Self: Sized,
Self::Index: VertexIndex + Mappable<Old>,
<Self::Index as Mappable<Old>>::Output<New>: VertexIndex + Mappable<New, Output<Old> = Self::Index> { ... }
fn trapezoidize(
&'p self,
) -> Result<Trapezoidation<'p, Self>, TrapezoidationError> { ... }
fn triangulate<FB: FanFormat<'p, Self>>(
&'p self,
format: FB,
) -> Result<<FB::Builder as FanBuilder<'p, Self>>::Output, TriangulationError<<FB::Builder as FanBuilder<'p, Self>>::Error>> { ... }
}
Expand description
An indexable list of polygons and their vertices
Required Associated Types§
Sourcetype Index: VertexIndex + 'p
type Index: VertexIndex + 'p
A type used to uniquely identify a Vertex (e.g. [usize; 2]
for a Vec<Vec<[f32, f32]>>)
Sourcetype IntoItem: Into<PolygonElement<Self::Index>>
type IntoItem: Into<PolygonElement<Self::Index>>
The PolygonList::Index Iterator type
Required Methods§
Sourcefn vertex_count(&self) -> usize
fn vertex_count(&self) -> usize
Provides the total number of vertices among all polygons.
Sourcefn iter_indices<'i>(&'i self) -> Self::Iter<'i>where
Self: 'i,
Self::Vertex: 'i,
'p: 'i,
fn iter_indices<'i>(&'i self) -> Self::Iter<'i>where
Self: 'i,
Self::Vertex: 'i,
'p: 'i,
Iterate through all Index
es of all polygons.
Indices must be returned in either clockwise or counter-clockwise order,
without repeating the initial index. Between each polygon, implementers
must return a NewPolygon
value.
ContinuePolygon
values must be yielded in successive groups of at least
3, otherwise triangulation will fail.
Successive NewPolygon
s are idempotent, and NewPolygon
s as the initial
or final iteration values have no effect.
Sourcefn get_vertex<'a>(&'a self, index: Self::Index) -> &'a Self::Vertexwhere
'p: 'a,
fn get_vertex<'a>(&'a self, index: Self::Index) -> &'a Self::Vertexwhere
'p: 'a,
Get the PolygonList::Vertex uniquely identified by index
Provided Methods§
Sourcefn index_with<Old: TryInto<New>, New: TryInto<Old>>(
self,
) -> IndexWith<'p, Self, Self::Index, Old, New>where
Self: Sized,
Self::Index: VertexIndex + Mappable<Old>,
<Self::Index as Mappable<Old>>::Output<New>: VertexIndex + Mappable<New, Output<Old> = Self::Index>,
fn index_with<Old: TryInto<New>, New: TryInto<Old>>(
self,
) -> IndexWith<'p, Self, Self::Index, Old, New>where
Self: Sized,
Self::Index: VertexIndex + Mappable<Old>,
<Self::Index as Mappable<Old>>::Output<New>: VertexIndex + Mappable<New, Output<Old> = Self::Index>,
Substitute the PolygonList::Index type with another.
The old index type must be convertable via TryInto to the new index type, and vice versa, but will panic if the conversion fails
Sourcefn trapezoidize(
&'p self,
) -> Result<Trapezoidation<'p, Self>, TrapezoidationError>
fn trapezoidize( &'p self, ) -> Result<Trapezoidation<'p, Self>, TrapezoidationError>
Generate a Trapezoidation, which can later be triangulated.
Unless the Trapezoidation is needed for other reasons, this can be done in a single step with PolygonList::triangulate.
Sourcefn triangulate<FB: FanFormat<'p, Self>>(
&'p self,
format: FB,
) -> Result<<FB::Builder as FanBuilder<'p, Self>>::Output, TriangulationError<<FB::Builder as FanBuilder<'p, Self>>::Error>>
fn triangulate<FB: FanFormat<'p, Self>>( &'p self, format: FB, ) -> Result<<FB::Builder as FanBuilder<'p, Self>>::Output, TriangulationError<<FB::Builder as FanBuilder<'p, Self>>::Error>>
Triangulate the polygons into the layout specified by format
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.