diff --git a/src/delaunay_core/handles/handle_defs.rs b/src/delaunay_core/handles/handle_defs.rs index 46dbcda..b68f72b 100644 --- a/src/delaunay_core/handles/handle_defs.rs +++ b/src/delaunay_core/handles/handle_defs.rs @@ -2,6 +2,7 @@ use core::convert::TryInto; use super::super::Dcel; use super::public_handles::{InnerOuterMarker, PossiblyOuterTag}; +use super::FixedVertexHandle; #[cfg(feature = "serde")] use serde::{Deserialize, Serialize}; @@ -43,6 +44,23 @@ pub const fn new_fixed_face_handle(index: usize) -> FixedHandleImpl= 2^32` + pub fn from_index(index: usize) -> Self { + // Preferably, `new` would simply be public. However, that would allow to create a handle + // to the outer face marked with `InnerTag` which is bad. Let's only allow vertices for now. + Self::new(index) + } +} + impl FixedHandleImpl { pub(crate) fn new(index: usize) -> Self { Self::new_internal( diff --git a/src/lib.rs b/src/lib.rs index 1393a66..c02611a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -114,6 +114,12 @@ mod test_utilities; /// | **Reference** | [vertices()](Triangulation::vertices()) | [directed_edges()](Triangulation::directed_edges) | [undirected_edges()](Triangulation::undirected_edges()) | [inner_faces()](Triangulation::inner_faces())
[all_faces()](Triangulation::all_faces()) | /// | **Fixed** | [fixed_vertices()](Triangulation::fixed_vertices()) | [fixed_directed_edges()](Triangulation::fixed_directed_edges()) | [fixed_undirected_edges()](Triangulation::fixed_undirected_edges()) | [fixed_inner_faces()](Triangulation::fixed_inner_faces())
[fixed_faces()](Triangulation::fixed_inner_faces()) | /// +/// # Creating handles directly +/// +/// In some cases it may be desireable to create vertex handles artificially by providing the index +/// manually. This can be done by calling [handles::FixedVertexHandle::from_index](from_index(usize)). +/// Make sure that the provided index is smaller than the number of vertices in the triangulation. +/// /// # Converting between reference and fixed handles /// /// Converting a reference handle into its fixed counterpart is performed via the