Skip to main content

vertex_tolerance_from_edges

Function vertex_tolerance_from_edges 

Source
pub fn vertex_tolerance_from_edges(
    endpoint_gaps: impl IntoIterator<Item = f64>,
    incident_edge_deviations: impl IntoIterator<Item = f64>,
) -> f64
Expand description

Propagate measured tolerances up one level of the entity hierarchy: from a vertex’s incident edges (and the gaps between their ends and the vertex point) to the vertex itself.

The vertex’s measured tolerance is the largest deviation any representation meeting there exhibits: the worst endpoint gap |p_V − c_E(t_end)| over the incident edge ends, and the worst measured deviation of those edges themselves — because a point that sits exactly on a curve which is itself d off its intended locus is d off that locus too.

§On OCCT’s 1.001 factor — assessed, and deliberately NOT copied

BRepOffset_SimpleOffset::FillVertexData sets the vertex tolerance to 1.001 × max(adjacent edge tolerances, endpoint spread) (BRepOffset_SimpleOffset.cxx:398-424). That factor is not geometry. OCCT requires the ordering Tol(V) ≥ Tol(E) ≥ Tol(F) to hold as a validity invariant on the persisted shape, re-checked by BRepCheck_Vertex / BRepCheck_Edge and re-imposed by BRepLib::UpdateTolerances after operations that recompute either side. A vertex tolerance set exactly equal to its edge’s can be inverted by nothing more than a recomputation’s last bit, so they pad by a tenth of a percent. It is an invariant fudge, and it is theirs because their tolerances are persisted, grow-only, and re-derived by checkers that compare them with >.

We have no such consumer. Nothing in this kernel stores a per-entity tolerance (see MeasuredTolerance’s “where it lives”) and therefore nothing re-derives one and compares it strictly against another. Copying the factor here would make the record false — it would report 0.1% more deviation than was observed — for a benefit that does not exist. So there is no factor, and this function returns exactly the worst thing it saw.

If a later slice does persist these values and does enforce an ordering invariant across a recompute (per-entity-tolerances.md S3), that slice should reintroduce a named padding constant at the invariant it protects, with the comparison it protects named — not here, and not silently.