pub struct Qh<'a> { /* private fields */ }Expand description
A Qhull instance
This struct is the main interface to the qhull library. It provides a way to compute the convex hull of a set of points and to access the results.
See the main crate documentation and the examples module/folder for some examples.
Implementations§
Source§impl<'a> Qh<'a>
impl<'a> Qh<'a>
Sourcepub fn compute(&mut self) -> Result<(), QhError<'_>>
pub fn compute(&mut self) -> Result<(), QhError<'_>>
Compute the convex hull
Wraps qhull_sys::qh_qhull,
Sourcepub fn prepare_output(&mut self) -> Result<(), QhError<'_>>
pub fn prepare_output(&mut self) -> Result<(), QhError<'_>>
Prepare the output of the qhull instance
Wraps qhull_sys::qh_prepare_output,
Sourcepub fn check_output(&mut self) -> Result<(), QhError<'_>>
pub fn check_output(&mut self) -> Result<(), QhError<'_>>
Check the output of the qhull instance
Wraps qhull_sys::qh_check_output,
pub fn check_points(&mut self) -> Result<(), QhError<'_>>
Sourcepub fn new_delaunay<I>(
points: impl IntoIterator<Item = I>,
) -> Result<Self, QhError<'static>>where
I: IntoIterator<Item = f64>,
pub fn new_delaunay<I>(
points: impl IntoIterator<Item = I>,
) -> Result<Self, QhError<'static>>where
I: IntoIterator<Item = f64>,
Creates a new Delaunay triangulation
See the examples directory for an example.
Sourcepub fn all_facets(&self) -> impl Iterator<Item = Facet<'_>>
pub fn all_facets(&self) -> impl Iterator<Item = Facet<'_>>
Get all the facets in the hull
§Remarks
- this function will also return the sentinel face, which is the last face in the list of facets.
To avoid it, use the
Qh::facetsfunction or justfilterthe iterator checking forFacet::is_sentinel.
Sourcepub fn all_facets_rev(&self) -> impl Iterator<Item = Facet<'_>>
pub fn all_facets_rev(&self) -> impl Iterator<Item = Facet<'_>>
Get all the facets in the hull in reverse order
See Qh::all_facets for more information.
Sourcepub fn facets(&self) -> impl Iterator<Item = Facet<'_>>
pub fn facets(&self) -> impl Iterator<Item = Facet<'_>>
Get the facets in the hull
§Remarks
- this function will not return the sentinel face, which is the last face in the list of facets.
To get it, use the
Qh::all_facetsfunction.
pub fn all_vertices(&self) -> impl Iterator<Item = Vertex<'_>>
pub fn all_vertices_rev(&self) -> impl Iterator<Item = Vertex<'_>>
pub fn vertices(&self) -> impl Iterator<Item = Vertex<'_>>
Sourcepub fn num_facets(&self) -> usize
pub fn num_facets(&self) -> usize
Number of facets in the hull (sentinel excluded)
§Example
assert_eq!(qh.num_facets(), qh.facets().count());Sourcepub fn num_vertices(&self) -> usize
pub fn num_vertices(&self) -> usize
Number of vertices in the hull (sentinel excluded)
§Example
assert_eq!(qh.num_vertices(), qh.vertices().count());pub fn simplices(&self) -> impl Iterator<Item = Facet<'_>>
Sourcepub unsafe fn raw_ptr(qh: &Qh<'_>) -> *mut qhT
pub unsafe fn raw_ptr(qh: &Qh<'_>) -> *mut qhT
Get the pointer to the raw qhT instance
§Warning
Always use a try function (e.g. QhError::try_1) when calling a fallible qhull function,
but not on non-fallible functions such as qhull_sys::qh_init_A since it would be invalid.