pub struct SolidClassifier<'a> { /* private fields */ }Expand description
Point-in-solid classification with per-solid precomputation: face bounds, the solid box, and a face BVH are built once so repeated queries (boolean fragment selection asks once per fragment) prune to the few faces a probe point or ray can actually touch.
Implementations§
Source§impl<'a> SolidClassifier<'a>
impl<'a> SolidClassifier<'a>
pub fn new( solid: &'a BrepSolid, tolerance: f64, ) -> Result<SolidClassifier<'a>, String>
Sourcepub fn chord_orientation(
&self,
through: Vec3,
direction: Vec3,
) -> Result<Option<bool>, String>
pub fn chord_orientation( &self, through: Vec3, direction: Vec3, ) -> Result<Option<bool>, String>
The orientation a chord through through along direction reads, or
None when the chord cannot tell (BREP_BOOLEAN_SIGN_CHORDS).
The chord runs from outside the faces’ box to outside it, so a closed,
consistently oriented boundary is entered and left in turn: its hits,
ordered along the chord, alternate between outward normals against
the chord and along it, and their number is even. Some(true) when
they do and the first is an entry (material lies behind the normals,
as on a solid of positive volume), Some(false) when they do and the
first is an exit (inside out). None when any hit is tangential,
grazes (|n · d| under 1e-2), falls in a trim’s boundary band, sits
within the On band of another hit, when the hits do not alternate or
are odd in number (a root the finder lost, or a face reversed against
its neighbours), or when no hit lies within the On band of through
(the aimed face itself was missed).
Sourcepub fn near_surface(&self, point: Vec3) -> Result<bool, String>
pub fn near_surface(&self, point: Vec3) -> Result<bool, String>
Cheap On-band probe: is the point within the classifier’s On tolerance of ANY face carrier (trim not checked — conservative)? Used to guard adjacency propagation: fragments near the other solid’s surface need the full normal-based On decision, everything else can inherit its fate from a neighbor.
Sourcepub fn within_band(&self, point: Vec3, band: f64) -> Result<bool, String>
pub fn within_band(&self, point: Vec3, band: f64) -> Result<bool, String>
Conservative carrier-proximity probe: is point within band of ANY
face’s carrier surface (trim NOT checked)? A strict superset of the
On verdict (which additionally requires the point to fall in a face’s
trim), so callers that want to skip every point that might be on or
near the boundary — the semantic oracle’s On-skip — can rely on a true
here to mean “not safely In/Out”. band is taken explicitly so the
caller can widen it to a size-relative width and absorb near-coincidence
gaps (Golovanov §4.13 derived tolerances).
pub fn classify(&self, point: Vec3) -> Result<PointClassification, String>
Sourcepub fn with_coincident_caps(self, caps: Vec<(Aabb, f64)>) -> SolidClassifier<'a>
pub fn with_coincident_caps(self, caps: Vec<(Aabb, f64)>) -> SolidClassifier<'a>
Wider-band On probe for near-coincident faces. A model built from
noisy input carries faces that are geometrically coincident with the
other solid’s boundary yet separated by a gap that scales with the
model (a few microns), not with the absolute model tolerance. Such a
gap slips a face fragment’s interior test point past the fixed On band
(classify), so it reads as a stray In/Out. This probe re-checks
whether point sits in the trim INTERIOR of a coincident boundary
face within a band derived from the solid’s size (Golovanov §4.13
derived tolerances), returning the mean outward normal of the
coincident faces when it does. It only ever RESCUES an On verdict —
callers keep the tight-band In/Out otherwise — so the general
classification path is unchanged. Interior-only (boundary hits are
ignored) so it fires only on a genuine surface overlap, never on mere
proximity to an edge.
Caps the coincident-On band within each region (see
coincident_caps): a test point a sliver’s width from the other
solid’s face is a feature, not noise to rescue to On.