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,

source

pub fn clear(&mut self)

clear the list of cells, vertices and edges

source

pub fn cells(&self) -> &Vec<Rc<Cell<Cell>>>

Returns a reference to the list of cells

source

pub fn vertices(&self) -> &Vec<Rc<Cell<Vertex<F>>>>

Returns a reference to all of the vertices

source

pub fn vertices_get_aabb<I>(&self) -> Aabb2<F>
where I: InputType,

Computes an AABB large enough to contain all the vertices

source

pub fn edges(&self) -> &Vec<Rc<Cell<Edge>>>

Returns a reference to the list of edges

source

pub fn get_cell(&self, cell_id: CellIndex) -> Result<Rc<Cell<Cell>>, BvError>

Returns a Rc<cell::Cell<>> belonging to the cell_id

source

pub fn get_edge(&self, edge_id: EdgeIndex) -> Result<Rc<Cell<Edge>>, BvError>

Returns the edge associated with the edge id

source

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.

source

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.

source

pub fn cell_iter(&self) -> Iter<'_, Rc<Cell<Cell>>>

👎Deprecated since 0.10.3: please use .cells().iter() instead

Returns an iterator over all cells

source

pub fn vertex_iter(&self) -> Iter<'_, Rc<Cell<Vertex<F>>>>

👎Deprecated since 0.10.3: please use .vertices().iter() instead

Returns an iterator over all vertices

source

pub fn edge_iter(&self) -> Iter<'_, Rc<Cell<Edge>>>

👎Deprecated since 0.10.3: please use .edges().iter() instead

Returns an iterator over all edges

source

pub fn num_cells(&self) -> usize

returns the number of cells in the diagram

source

pub fn num_edges(&self) -> usize

returns the number of edges in the diagram

source

pub fn num_vertices(&self) -> usize

returns the number of vertices in the diagram

source

pub fn reserve_(&mut self, additional_sites: usize)

reserves space for an number of additional sites

source

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.

source

pub fn vertex_get( &self, vertex_id: VertexIndex ) -> Result<&Rc<Cell<Vertex<F>>>, BvError>

Returns the vertex associated with the vertex_id

source

pub fn vertex_or_color(&self, vertex_id: VertexIndex, color: u32)

OR the previous color field value with this new color value

source

pub fn vertex_get_color(&self, vertex_id: Option<VertexIndex>) -> Option<u32>

Returns the color field of the vertex.

source

pub fn vertex_get_incident_edge( &self, vertex_id: Option<VertexIndex> ) -> Option<EdgeIndex>

return one of the edges originating at the vertex

source

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

source

pub fn vertex_is_site_point( &self, vertex_id: VertexIndex ) -> Result<bool, BvError>

returns true if this vertex coincides with an site point

source

pub fn edge_get_color(&self, edge_id: EdgeIndex) -> Result<u32, BvError>

Returns the color field of the edge.

source

pub fn edge_set_color( &self, edge_id: EdgeIndex, color: u32 ) -> Result<(), BvError>

Sets the color field with new value

source

pub fn edge_or_color( &self, edge_id: EdgeIndex, color: u32 ) -> Result<(), BvError>

OR the previous color field value with this new color value

source

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.

source

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.

source

pub fn edge_get_twin(&self, edge_id: EdgeIndex) -> Result<EdgeIndex, BvError>

source

pub fn edge_get_next(&self, edge_id: EdgeIndex) -> Result<EdgeIndex, BvError>

source

pub fn edge_get_cell(&self, edge_id: EdgeIndex) -> Result<CellIndex, BvError>

source

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).

source

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).

source

pub fn edge_get_vertex0( &self, edge_id: EdgeIndex ) -> Result<Option<VertexIndex>, BvError>

source

pub fn edge_get_vertex1( &self, edge_id: EdgeIndex ) -> Result<Option<VertexIndex>, BvError>

source

pub fn edge_rot_next(&self, edge_id: EdgeIndex) -> Result<EdgeIndex, BvError>

Returns a pointer to the rotation next edge over the starting point of the half-edge.

source

pub fn edge_rot_prev(&self, edge_id: Option<EdgeIndex>) -> Option<EdgeIndex>

Returns a pointer to the rotation previous edge over the starting point of the half-edge.

Trait Implementations§

source§

impl<F> Debug for Diagram<F>
where F: Debug + OutputType,

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

impl<F> Default for Diagram<F>
where F: Default + OutputType,

source§

fn default() -> Diagram<F>

Returns the “default value” for a type. Read more
source§

impl<F> From<Diagram<F>> for SyncDiagram<F>
where F: OutputType,

source§

fn from(other: Diagram<F>) -> SyncDiagram<F>

Converts a Diagram into a SyncDiagram by dropping the std::cell::Cell and Rc

Auto Trait Implementations§

§

impl<F> !RefUnwindSafe for Diagram<F>

§

impl<F> !Send for Diagram<F>

§

impl<F> !Sync for Diagram<F>

§

impl<F> Unpin for Diagram<F>

§

impl<F> !UnwindSafe for Diagram<F>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.