From eca0539260e502fef0cf8cae52f420d50e7c6302 Mon Sep 17 00:00:00 2001 From: msv <msv@opencascade.com> Date: Wed, 9 Nov 2016 18:27:47 +0300 Subject: [PATCH] 0028081: Fix regression in HLR introduced by the fix for 28053 The whole piece of the walking line between two vertices is no more checked for having length greater than Precision::Confusion(). Instead, only full duplicate points (comparing with gp::Resolution()) are removed, allowing the resulting line have any non-null length. The test bugs modalg_6 bug27720_5 has been reverted to its original state. --- src/Contap/Contap_Contour.cxx | 17 +++++++++-------- tests/bugs/modalg_6/bug27720_5 | 2 +- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/Contap/Contap_Contour.cxx b/src/Contap/Contap_Contour.cxx index 0bcc1c6302..ab4ebfb3d9 100644 --- a/src/Contap/Contap_Contour.cxx +++ b/src/Contap/Contap_Contour.cxx @@ -307,22 +307,23 @@ static void LineConstructor(Contap_TheSequenceOfLine& slin, else { //-- cout<<"ContapWLine : firtsp="<<firstp<<" lastp="<<lastp<<" Vtx:"<<i<<","<<i+1<<endl; Handle(IntSurf_LineOn2S) LineOn2S = new IntSurf_LineOn2S(); - Contap_Line Line; - Standard_Real aLen = 0.; - for(Standard_Integer j=firstp; j<=lastp; j++) { - LineOn2S->Add(L.Point(j)); - if (j > firstp) - aLen += L.Point(j).Value().Distance(L.Point(j - 1).Value()); + LineOn2S->Add(L.Point(firstp)); + for (Standard_Integer j = firstp + 1; j <= lastp; j++) { + Standard_Real aSqDist = L.Point(j).Value(). + SquareDistance(L.Point(j - 1).Value()); + if (aSqDist > gp::Resolution()) + LineOn2S->Add(L.Point(j)); } - if (aLen < Precision::Confusion()) + if (LineOn2S->NbPoints() < 2) continue; + Contap_Line Line; Line.SetLineOn2S(LineOn2S); Contap_Point pvtx = L.Vertex(i); pvtx.SetParameter(1); Line.Add(pvtx); pvtx = L.Vertex(i+1); - pvtx.SetParameter(lastp-firstp+1); + pvtx.SetParameter(LineOn2S->NbPoints()); Line.Add(pvtx); Line.SetTransitionOnS(L.TransitionOnS()); slin.Append(Line); diff --git a/tests/bugs/modalg_6/bug27720_5 b/tests/bugs/modalg_6/bug27720_5 index b90f52e510..167ba2a564 100644 --- a/tests/bugs/modalg_6/bug27720_5 +++ b/tests/bugs/modalg_6/bug27720_5 @@ -21,6 +21,6 @@ build3d result fit checkprops result -l 0.841499 -checknbshapes result -vertex 94 -edge 47 +checknbshapes result -vertex 92 -edge 46 checkview -screenshot -2d -path ${imagedir}/${test_image}.png