Qh

Struct Qh 

Source
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>

Source

pub fn builder() -> QhBuilder

Create a new builder

Source

pub fn compute(&mut self) -> Result<(), QhError<'_>>

Compute the convex hull

Wraps qhull_sys::qh_qhull,

Source

pub fn prepare_output(&mut self) -> Result<(), QhError<'_>>

Prepare the output of the qhull instance

Wraps qhull_sys::qh_prepare_output,

Source

pub fn check_output(&mut self) -> Result<(), QhError<'_>>

Check the output of the qhull instance

Wraps qhull_sys::qh_check_output,

Source

pub fn check_points(&mut self) -> Result<(), QhError<'_>>

Source

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.

Source

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::facets function or just filter the iterator checking for Facet::is_sentinel.
Source

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.

Source

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_facets function.
Source

pub fn all_vertices(&self) -> impl Iterator<Item = Vertex<'_>>

Source

pub fn all_vertices_rev(&self) -> impl Iterator<Item = Vertex<'_>>

Source

pub fn vertices(&self) -> impl Iterator<Item = Vertex<'_>>

Source

pub fn num_facets(&self) -> usize

Number of facets in the hull (sentinel excluded)

§Example
assert_eq!(qh.num_facets(), qh.facets().count());
Source

pub fn num_vertices(&self) -> usize

Number of vertices in the hull (sentinel excluded)

§Example
assert_eq!(qh.num_vertices(), qh.vertices().count());
Source

pub fn simplices(&self) -> impl Iterator<Item = Facet<'_>>

Source

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.

Source

pub fn buffers(&self) -> &RefCell<IOBuffers>

Trait Implementations§

Source§

impl<'a> Drop for Qh<'a>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

§

impl<'a> !Freeze for Qh<'a>

§

impl<'a> !RefUnwindSafe for Qh<'a>

§

impl<'a> !Send for Qh<'a>

§

impl<'a> !Sync for Qh<'a>

§

impl<'a> Unpin for Qh<'a>

§

impl<'a> UnwindSafe for Qh<'a>

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>,

Source§

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>,

Source§

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.