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
impl SignBuild
Sourcepub fn new(mesh: &Mesh, bvh: &Bvh, mode: SignMode) -> Result<SignBuild>
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.
Sourcepub fn is_for(&self, mesh: &Mesh, bvh: &Bvh) -> bool
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.
Sourcepub fn step(
&mut self,
mesh: &mut Mesh,
bvh: &Bvh,
budget: usize,
) -> Result<bool>
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.
Sourcepub fn finish(self) -> Option<SignData>
pub fn finish(self) -> Option<SignData>
The sign data, once SignBuild::step returned true; None
before.