// The values in m_tolerance[] record the accuracy of
// the parameter space trimming curves.
//
// Remarks:
// m_tolerance[0] = accuracy of parameter space curve
// in first ( "u" ) parameter
//
// m_tolerance[1] = accuracy of parameter space curve
// in second ( "v" ) parameter
//
// A value of ON_UNSET_VALUE indicates that the
// tolerance should be computed. If the value >= 0.0,
// then the tolerance is set. If the value is
// ON_UNSET_VALUE, then the tolerance needs to be
// computed.
//
// If the trim is not singular, then the trim must
// have an edge. If P is a 3d point on the edge's
// curve and surface(u,v) = Q is the point on the
// surface that is closest to P, then there must
// be a parameter t in the interval [m_t[0], m_t[1]]
// such that
//
// |u - curve2d(t)[0]| <= m_tolerance[0]
//
// and
//
// |v - curve2d(t)[1]| <= m_tolerance[1]
//
// If P is the 3d point for the vertex brep.m_V[m_vi[k]]
// and (uk,vk) is the corresponding end of the trim's
// parameter space curve, then there must be a surface
// parameter (u,v) such that:
//
// * the distance from the 3d point surface(u,v) to P
// is <= brep.m_V[m_vi[k]].m_tolerance,
// * |u-uk| <= m_tolerance[0].
// * |v-vk| <= m_tolerance[1].
However this description of “Trim Tolerance” doesn’t answer the code of SetTrimTolerance method which sets tollerances of the trims calculating the x and y distances of the neighbouring trim’s end-points…
However, this fact of lacking tolerance in parameter space raises further questions:
Brep’s IsValid checker method considers a loop being valid if the end points of adjacent trims are closer than the very-very small fix value of ON_ZERO_TOLERANCE.
Does this mean that if a model is not accurate enough in parameter space, i.e. the distance of the end points of the adjacent pcurves are larger than this very small ON_ZERO_TOLERANCE than you have to extend the pcurves to “intersect” each other (or at least get closer to each other than this zero tolerance) ?
Is there any other trick to handle parameter space inaccuracies?
Is the “extended pcurces” the only way to make a loop valid or should a brep be scaled somehow in the parameter space to become valid?
(Anyway, I have checked the Open Cascade source code which uses vertex tolerances to handle this kind of inaccuracy not only in 3d but in parameter space too…)