Skip to main content

SolidClassifier

Struct SolidClassifier 

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

Source

pub fn new( solid: &'a BrepSolid, tolerance: f64, ) -> Result<SolidClassifier<'a>, String>

Source

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).

Source

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.

Source

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).

Source

pub fn classify(&self, point: Vec3) -> Result<PointClassification, String>

Source

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.

Source

pub fn coincident_on_normal(&self, point: Vec3) -> Result<Option<Vec3>, String>

Auto Trait Implementations§

§

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

§

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

§

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

§

impl<'a> !UnwindSafe for SolidClassifier<'a>

§

impl<'a> Forget for SolidClassifier<'a>

§

impl<'a> Freeze for SolidClassifier<'a>

§

impl<'a> Move for SolidClassifier<'a>

§

impl<'a> Unpin for SolidClassifier<'a>

§

impl<'a> UnsafeUnpin for SolidClassifier<'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 = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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

impl<S, T> Upcast<T> for S
where T: UpcastFrom<S> + ?Sized, S: ?Sized,

Source§

fn upcast(&self) -> &T
where Self: ErasableGeneric, T: Sized + ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider ref type within the Wasm bindgen generics type system. Read more
Source§

fn upcast_into(self) -> T
where Self: Sized + ErasableGeneric, T: Sized + ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider type within the Wasm bindgen generics type system. Read more