[BUG?] Vertex tolerance is not recognized during edge creation (in certain cases)

Hi, I have just stumbled across the following code in BRepLib_MakeEdge.cxx. It's a routine to check, whether the vertices used for creation of an edge from a 2d curve on a surface are actually lying on the curve.
The code appears inconsistent with the vertex tolerance definition to me:
In the code below, the vertex tolerance is considered for vertices lying at FirstParameter and LastParameter on the curve and it is NOT considered for vertices lying somewhere in between. They get projected on the curve, next it is tested whether their projection and the original point are equal up to Precision::Confusion. This is an unnecessary harsh requirement.
I should be able to create an edge limited by vertices lying in the vicinity of the curve only up to their vertex tolerance. Why? In order to be a valid edge, the distance between the respective parameters on the curve and the vertices has to be below the vertex tolerance. They don't have to be equal up to Precision::Confusion()!

static Standard_Boolean Project(const Handle(Geom2d_Curve)& C,
const Handle(Geom_Surface)& S,
const TopoDS_Vertex& V,
Standard_Real& p)
gp_Pnt P = BRep_Tool::Pnt(V);
Standard_Real Eps2 = BRep_Tool::Tolerance(V);
Eps2 *= Eps2;

static Handle(Geom2dAdaptor_HCurve) HG2AHC;
if ( HG2AHC.IsNull() ) HG2AHC = new Geom2dAdaptor_HCurve();
static Handle(GeomAdaptor_HSurface) HGAHS;
if ( HGAHS.IsNull() ) HGAHS = new GeomAdaptor_HSurface();
Adaptor3d_CurveOnSurface ACOS(HG2AHC,HGAHS);

Standard_Real D1,D2;
gp_Pnt P1,P2;
P1 = ACOS.Value(ACOS.FirstParameter());
P2 = ACOS.Value(ACOS.LastParameter());
D1 = P1.SquareDistance(P);
D2 = P2.SquareDistance(P);
if ( (D1 p = ACOS.FirstParameter();
return Standard_True;
else if ( (D2 p = ACOS.LastParameter();
return Standard_True;

Extrema_ExtPC extrema(P,ACOS);

if (extrema.IsDone()) {
Standard_Integer i, index = 0, n = extrema.NbExt();
Standard_Real Dist2 = RealLast(), dist2min;

for (i = 1; i dist2min = extrema.SquareDistance(i);
if (dist2min index = i;
Dist2 = dist2min;

if (index != 0) {
Extrema_POnCurv POC = extrema.Point(index);
if (P.SquareDistance(POC.Value()) p = POC.Parameter();
return Standard_True;
return Standard_False;

Fabian Hachenberg's picture

Now is this a bug or not?

jelle's picture

hi Fabian,

you're so active on this forum.
the OCE [ OCC community edition ] makes it easy to fork & share your bug fixes.
we'd appreciate your input.


OCE is a project that tries to streamline OCC development by offering modern development tools.
Hopefully these efforts will stream back into OCC's releases.
Git sure as hell makes doing so a lot easier ;)


Fabian Hachenberg's picture

Hi jelle,

I reported this possible bug already at github but there haven't got any response either ;)

Forum supervisor's picture

Hi Fabian,
I would like to inform you that the posted problem is a bug.
The corresponding issue with ID = OCC22605 has been registered.
Later you can know if the issue is resolved by checking references to the specified ID in OCCT Release Notes. The analysis of the issue will take some time depending on our technical capability and availability of resources.
Thanks for your contribution.