View Issue Details

IDProjectCategoryView StatusLast Update
0022605CommunityOCCT:Modeling Algorithmspublic2023-08-01 15:08
ReporterszyAssigned Tojgv 
PrioritynormalSeveritytrivial 
Status assignedResolutionreopened 
OSAll 
Target VersionUnscheduled 
Summary0022605: Vertex tolerance is not recognized during edge creation
DescriptionPost from the Forum - http://www.opencascade.org/org/forum/thread_20771/.
It contains patch (to be analyzed).
-------------------------------------------------------------------------
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();
HG2AHC->Set(C);
static Handle(GeomAdaptor_HSurface) HGAHS;
if ( HGAHS.IsNull() ) HGAHS = new GeomAdaptor_HSurface();
HGAHS->Set(S);
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 < D2) && (D1 <= Eps2) ) {
p = ACOS.FirstParameter();
return Standard_True;
}
else if ( (D2 < D1) && (D2 <= Eps2) ) {
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 <= n; i++) {
dist2min = extrema.SquareDistance(i);
if (dist2min < Dist2) {
     index = i;
     Dist2 = dist2min;
}
}

if (index != 0) {
Extrema_POnCurv POC = extrema.Point(index);
if (P.SquareDistance(POC.Value()) <= Precision::Confusion() *
Precision::Confusion()) {
     p = POC.Parameter();
     return Standard_True;
}
}
}
return Standard_False;
}
TagsNo tags attached.
Test case number

Activities

There are no notes attached to this issue.

Issue History

Date Modified Username Field Change
2011-08-02 11:31 bugmaster Category OCCT:MOA => OCCT:Modeling Algorithms
2011-11-24 16:39 szy Assigned To bugmaster => jgv
2011-11-24 16:39 szy Status acknowledged => assigned
2011-11-24 16:39 szy Resolution suspended => reopened
2011-11-24 16:39 szy Fixed in Version EMPTY =>
2011-11-24 16:39 szy Description Updated
2014-07-14 09:41 abv Assigned To jgv => ifv
2014-07-14 09:41 abv Target Version => 6.8.0
2014-07-25 17:17 ifv Assigned To ifv => jgv
2014-09-26 14:23 abv Target Version 6.8.0 => 7.1.0
2016-10-28 15:33 msv Target Version 7.1.0 => 7.2.0
2017-07-21 11:34 msv Target Version 7.2.0 => 7.3.0
2017-12-05 17:09 msv Target Version 7.3.0 => 7.4.0
2019-08-12 16:44 msv Target Version 7.4.0 => 7.5.0
2020-09-14 22:55 msv Target Version 7.5.0 => 7.6.0
2021-08-29 18:52 msv Target Version 7.6.0 => 7.7.0
2022-10-24 10:42 szy Target Version 7.7.0 => 7.8.0
2023-08-01 15:08 dpasukhi Target Version 7.8.0 => Unscheduled