Skip to main content

KernelTolerances

Struct KernelTolerances 

Source
pub struct KernelTolerances {
    pub convergence: f64,
    pub model: f64,
    pub intersection_fit: f64,
    pub pcurve_consistency: f64,
    pub export_knit: f64,
    pub sew_search: f64,
    pub sliver: f64,
    pub angular: f64,
}
Expand description

Ordered accuracy targets plus deliberately separate geometric search radii.

Search tolerances answer “which entities might match?”. Accuracy tolerances answer “how closely must committed geometry agree?”. Keeping those questions separate prevents a generous sewing search radius from becoming the accuracy of the exported BREP.

Fields§

§convergence: f64

Iterative projection/refinement convergence target.

§model: f64

Vertex identity and exact topological coincidence tolerance.

§intersection_fit: f64

Maximum geometric error accepted while fitting SSI curves.

§pcurve_consistency: f64

Maximum edge/pcurve/carrier disagreement in a valid in-memory BREP.

§export_knit: f64

Output edge-to-carrier contract used before STEP serialization.

§sew_search: f64

Candidate radius used while looking for endpoints or edges to weld.

§sliver: f64

Features shorter than this are candidates for explicit sliver repair.

§angular: f64

Angular tolerance in radians.

Implementations§

Source§

impl KernelTolerances

Source

pub fn for_scale(scale: f64, model: f64) -> Self

Construct a scale-aware policy while preserving the historical model identity tolerance used by the public API.

The base spatial identity tolerance model is deliberately NOT coupled to part size here: coupling it was tried and rejected because model also feeds fit-accuracy fields (intersection_fit, sew_search), so scaling it degrades SSI curve fitting on ordinary parts and produces invalid boolean topology (see revolve_pole_union_fixture). Identity bands that legitimately scale with size are size-coupled per site via KernelTolerances::heal_band instead, leaving fit accuracy tight.

Source

pub fn for_solid(solid: &BrepSolid, model: f64) -> Self

Source

pub fn for_pair(first: &BrepSolid, second: &BrepSolid, model: f64) -> Self

Source

pub fn check(&self) -> Result<(), String>

Reject policies whose accuracy ladder is inverted or whose search radii cannot even find model-identical entities.

Source

pub fn spatial(&self) -> f64

Canonical accessor for the single spatial tolerance x (Golovanov §4.13). model is that x: the base identity/coincidence band from which parametric, search, and healing tolerances are derived. Call sites should prefer this over reaching for .model directly so intent (the ONE spatial tolerance) reads clearly and later levers have a single seam to evolve.

Source

pub fn heal_band(&self, diagonal: f64, k: f64) -> f64

Size-coupled healing/identity band: the base spatial tolerance floored by a fraction k of the caller’s local diagonal. This is the ONE charter helper for the max(model, diagonal * k) pattern that healing and identity sites otherwise hand-roll (e.g. classification’s near-coincidence probe (model * 10).max(diagonal * 1e-7)), so a size-relative band is derived from x in a single place instead of re-hardcoded per call site (Golovanov §4.13). Coupling the band HERE — at the identity/weld/heal site, taking diagonal explicitly — gives big parts a proportionally wider identity band WITHOUT inflating the global model or the fit-accuracy path (intersection_fit, the marcher). k is a dimensionless part-per-diagonal factor; diagonal is the local extent the band should scale with.

Source

pub fn pcurve_acceptance(&self, diagonal: f64) -> f64

Size-coupled acceptance ceiling for the edge-vs-pcurve COINCIDENCE check in BrepSolid::validate: “does this coedge’s curve-on-surface, pushed back to 3D, still trace the same locus as the edge’s 3D curve?”

This is an IDENTITY/coincidence band (are the two representations the SAME edge?), not a fit-accuracy target, so per this module’s taxonomy it MAY — and, for imported geometry, MUST — size-couple with the part: a vendor STEP file routinely commits an edge’s 3D curve and its face surface as INDEPENDENT approximations that disagree by a small fraction of the model, and (like Parasolid/OCC, which absorb the gap in a widened per-edge tolerance) a coincidence band floored to a tight ABSOLUTE pcurve_consistency wrongly rejects such a shared edge on a sub-unit part. The gap is intrinsic to the vendor data (it is the closest-point residual of the edge against the surface, so no pcurve fit can beat it), and the edge is SHARED — snapping it onto one face’s surface only pushes it off the neighbour’s — so accepting the size-relative gap is the faithful, non-destructive resolution.

Coupling lives HERE (taking the model diagonal explicitly, floored by the tight pcurve_consistency) exactly like KernelTolerances::heal_band, so the fit target and the STEP-import edge-reconcile screen — which read the raw pcurve_consistency FIELD — stay tight and are NOT relaxed by this validator-only ceiling. PCURVE_ACCEPTANCE_REL (2.5% of the model diagonal) sits above the vendor near-miss this admits (~2% of the diagonal on ABC 00000041) yet far below the many-percent excursion a genuinely wrong carrier or branch-jumped pcurve produces, so real breakage is still refused.

Trait Implementations§

Source§

impl Clone for KernelTolerances

Source§

fn clone(&self) -> KernelTolerances

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for KernelTolerances

Source§

impl Debug for KernelTolerances

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for KernelTolerances

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for KernelTolerances

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for KernelTolerances

Source§

fn eq(&self, other: &KernelTolerances) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for KernelTolerances

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for KernelTolerances

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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, <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.
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