Skip to main content

SignBuild

Struct SignBuild 

Source
pub struct SignBuild { /* private fields */ }
Expand description

SignData::build cut into steps, so that a caller can yield between them: the mesh’s adjacency and incidence (when not cached), then each pass of the build, a bounded number of elements per step.

Every element of a pass is computed on its own, and the counts and flags combine in any order, so the finished data is the same, bit for bit, as from SignData::build (which runs one of these to the end), with or without the parallel feature: within a step, a long enough run of elements still runs in parallel chunks. A build is tied to the mesh state and BVH generation it started from (SignBuild::is_for); stepping it on another state fails.

Implementations§

Source§

impl SignBuild

Source

pub fn new(mesh: &Mesh, bvh: &Bvh, mode: SignMode) -> Result<SignBuild>

A build of mesh’s sign data in mode, against bvh, with nothing done yet.

§Errors

FieldsError::Query with MeshMismatch or StaleBvh when bvh does not match the current mesh.

Source

pub fn is_for(&self, mesh: &Mesh, bvh: &Bvh) -> bool

Whether the build started from mesh and bvh as they are now (see SignData::is_current), with the same slot counts.

Source

pub fn is_done(&self) -> bool

Whether every pass is done.

Source

pub fn step( &mut self, mesh: &mut Mesh, bvh: &Bvh, budget: usize, ) -> Result<bool>

Runs the build over up to budget more elements (at least one, unless it is done): triangle, vertex or corner slots of a pass, or leaves of the winding moments and their node slots while those initialise, a vertex pseudonormal counting as 12, an edge normal as 2 and a triangle of the adjacency build as 3, for what they cost. A step that finishes the mesh’s adjacency or incidence ends there. Returns whether the build is done.

§Errors

FieldsError::InvalidInput when mesh and bvh are not the state the build started from (SignBuild::is_for); FieldsError::OutOfMemory or FieldsError::Store when an array cannot be allocated. The build is unusable after an error.

Source

pub fn finish(self) -> Option<SignData>

The sign data, once SignBuild::step returned true; None before.

Trait Implementations§

Source§

impl Debug for SignBuild

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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.