Struct boostvoronoi::Diagram
source · pub struct Diagram<F>where
F: OutputType,{ /* private fields */ }
Expand description
Voronoi output data structure based on data wrapped in Rc<Cell<T>>
.
See SyncDiagram
for a version of this structure without the Rc<Cell>
.
CCW ordering is used on the faces perimeter and around the vertices. Mandatory reading: https://www.boost.org/doc/libs/1_76_0/libs/polygon/doc/voronoi_diagram.htm
Implementations§
source§impl<F> Diagram<F>where
F: OutputType,
impl<F> Diagram<F>where
F: OutputType,
sourcepub fn vertices_get_aabb<I>(&self) -> Aabb2<F>where
I: InputType,
pub fn vertices_get_aabb<I>(&self) -> Aabb2<F>where
I: InputType,
Computes an AABB large enough to contain all the vertices
sourcepub fn get_cell(&self, cell_id: CellIndex) -> Result<Rc<Cell<Cell>>, BvError>
pub fn get_cell(&self, cell_id: CellIndex) -> Result<Rc<Cell<Cell>>, BvError>
Returns a Rc<cell::Cell<>> belonging to the cell_id
sourcepub fn get_edge(&self, edge_id: EdgeIndex) -> Result<Rc<Cell<Edge>>, BvError>
pub fn get_edge(&self, edge_id: EdgeIndex) -> Result<Rc<Cell<Edge>>, BvError>
Returns the edge associated with the edge id
sourcepub fn edge_as_line(&self, edge_id: EdgeIndex) -> Result<[F; 4], BvError>
pub fn edge_as_line(&self, edge_id: EdgeIndex) -> Result<[F; 4], BvError>
Return the edge represented as an straight line if the edge does not exists or if it lacks v0 or v1; None will be returned.
sourcepub fn color_exterior_edges(&self, external_color: u32)
pub fn color_exterior_edges(&self, external_color: u32)
Iterates over all edges, colors each edge as exterior if it has an unbroken primary edge link connection to an infinite edge.
sourcepub fn cell_iter(&self) -> Iter<'_, Rc<Cell<Cell>>>
👎Deprecated since 0.10.3: please use .cells().iter()
instead
pub fn cell_iter(&self) -> Iter<'_, Rc<Cell<Cell>>>
.cells().iter()
insteadReturns an iterator over all cells
sourcepub fn vertex_iter(&self) -> Iter<'_, Rc<Cell<Vertex<F>>>>
👎Deprecated since 0.10.3: please use .vertices().iter()
instead
pub fn vertex_iter(&self) -> Iter<'_, Rc<Cell<Vertex<F>>>>
.vertices().iter()
insteadReturns an iterator over all vertices
sourcepub fn edge_iter(&self) -> Iter<'_, Rc<Cell<Edge>>>
👎Deprecated since 0.10.3: please use .edges().iter()
instead
pub fn edge_iter(&self) -> Iter<'_, Rc<Cell<Edge>>>
.edges().iter()
insteadReturns an iterator over all edges
sourcepub fn num_vertices(&self) -> usize
pub fn num_vertices(&self) -> usize
returns the number of vertices in the diagram
sourcepub fn reserve_(&mut self, additional_sites: usize)
pub fn reserve_(&mut self, additional_sites: usize)
reserves space for an number of additional sites
sourcepub fn cell_edge_iterator(&self, cell_id: CellIndex) -> EdgeNextIterator<'_, F>
pub fn cell_edge_iterator(&self, cell_id: CellIndex) -> EdgeNextIterator<'_, F>
Returns an edge iterator. This iterates over the edges belonging to this cell starting with the incident edge.
sourcepub fn vertex_get(
&self,
vertex_id: VertexIndex
) -> Result<&Rc<Cell<Vertex<F>>>, BvError>
pub fn vertex_get( &self, vertex_id: VertexIndex ) -> Result<&Rc<Cell<Vertex<F>>>, BvError>
Returns the vertex associated with the vertex_id
sourcepub fn vertex_or_color(&self, vertex_id: VertexIndex, color: u32)
pub fn vertex_or_color(&self, vertex_id: VertexIndex, color: u32)
OR the previous color field value with this new color value
sourcepub fn vertex_get_color(&self, vertex_id: Option<VertexIndex>) -> Option<u32>
pub fn vertex_get_color(&self, vertex_id: Option<VertexIndex>) -> Option<u32>
Returns the color field of the vertex.
sourcepub fn vertex_get_incident_edge(
&self,
vertex_id: Option<VertexIndex>
) -> Option<EdgeIndex>
pub fn vertex_get_incident_edge( &self, vertex_id: Option<VertexIndex> ) -> Option<EdgeIndex>
return one of the edges originating at the vertex
sourcepub fn vertex_set_color(
&self,
vertex_id: VertexIndex,
color: u32
) -> Result<(), BvError>
pub fn vertex_set_color( &self, vertex_id: VertexIndex, color: u32 ) -> Result<(), BvError>
Set the color of the vertex. This affects only the public bits, not the internal
sourcepub fn vertex_is_site_point(
&self,
vertex_id: VertexIndex
) -> Result<bool, BvError>
pub fn vertex_is_site_point( &self, vertex_id: VertexIndex ) -> Result<bool, BvError>
returns true if this vertex coincides with an site point
sourcepub fn edge_get_color(&self, edge_id: EdgeIndex) -> Result<u32, BvError>
pub fn edge_get_color(&self, edge_id: EdgeIndex) -> Result<u32, BvError>
Returns the color field of the edge.
sourcepub fn edge_set_color(
&self,
edge_id: EdgeIndex,
color: u32
) -> Result<(), BvError>
pub fn edge_set_color( &self, edge_id: EdgeIndex, color: u32 ) -> Result<(), BvError>
Sets the color field with new value
sourcepub fn edge_or_color(
&self,
edge_id: EdgeIndex,
color: u32
) -> Result<(), BvError>
pub fn edge_or_color( &self, edge_id: EdgeIndex, color: u32 ) -> Result<(), BvError>
OR the previous color field value with this new color value
sourcepub fn edge_rot_next_iterator(
&self,
edge_id: Option<EdgeIndex>
) -> EdgeRotNextIterator<'_, F>
pub fn edge_rot_next_iterator( &self, edge_id: Option<EdgeIndex> ) -> EdgeRotNextIterator<'_, F>
Returns an edge iterator, the edges will all originate at the same vertex as ‘edge_id’. ‘edge_id’ will be the first edge returned by the iterator. Do NOT use this when altering next, prev or twin edges.
sourcepub fn edge_rot_prev_iterator(
&self,
edge_id: Option<EdgeIndex>
) -> EdgeRotPrevIterator<'_, F>
pub fn edge_rot_prev_iterator( &self, edge_id: Option<EdgeIndex> ) -> EdgeRotPrevIterator<'_, F>
Returns an edge iterator, the edges will all originate at the same vertex as ‘edge_id’. ‘edge_id’ will be the first edge returned by the iterator. Do NOT use this when altering next, prev or twin edges.
pub fn edge_get_twin(&self, edge_id: EdgeIndex) -> Result<EdgeIndex, BvError>
pub fn edge_get_next(&self, edge_id: EdgeIndex) -> Result<EdgeIndex, BvError>
pub fn edge_get_cell(&self, edge_id: EdgeIndex) -> Result<CellIndex, BvError>
sourcepub fn edge_is_finite(&self, edge_id: EdgeIndex) -> Result<bool, BvError>
pub fn edge_is_finite(&self, edge_id: EdgeIndex) -> Result<bool, BvError>
Returns true if the edge is finite (segment, parabolic arc). Returns false if the edge is infinite (ray, line).
sourcepub fn edge_is_infinite(&self, edge_id: EdgeIndex) -> Result<bool, BvError>
pub fn edge_is_infinite(&self, edge_id: EdgeIndex) -> Result<bool, BvError>
Returns true if the edge is infinite (ray, line). Returns false if the edge is finite (segment, parabolic arc).
pub fn edge_get_vertex0( &self, edge_id: EdgeIndex ) -> Result<Option<VertexIndex>, BvError>
pub fn edge_get_vertex1( &self, edge_id: EdgeIndex ) -> Result<Option<VertexIndex>, BvError>
Trait Implementations§
source§impl<F> From<Diagram<F>> for SyncDiagram<F>where
F: OutputType,
impl<F> From<Diagram<F>> for SyncDiagram<F>where
F: OutputType,
source§fn from(other: Diagram<F>) -> SyncDiagram<F>
fn from(other: Diagram<F>) -> SyncDiagram<F>
Converts a Diagram
into a SyncDiagram
by dropping the std::cell::Cell
and Rc