From: aml Date: Fri, 3 Jun 2016 17:08:00 +0000 (+0300) Subject: 0027565: [Regression to OCCT 7.0.0] Number of Intersections Is Wrong X-Git-Tag: V7_0_winwerth~15 X-Git-Url: http://git.dev.opencascade.org/gitweb/?p=occt.git;a=commitdiff_plain;h=f84bf635f06a97977a92524b78c356da2e56e72a 0027565: [Regression to OCCT 7.0.0] Number of Intersections Is Wrong Incorrect tolerance management is fixed. Test case is added. --- diff --git a/src/BRepTest/BRepTest_ExtremaCommands.cxx b/src/BRepTest/BRepTest_ExtremaCommands.cxx index 9c2f9dbe33..73ccbfd4d6 100644 --- a/src/BRepTest/BRepTest_ExtremaCommands.cxx +++ b/src/BRepTest/BRepTest_ExtremaCommands.cxx @@ -31,6 +31,7 @@ #include #include #include +#include //#ifdef _MSC_VER @@ -65,16 +66,18 @@ static Standard_Integer distance (Draw_Interpretor& di, } static Standard_Integer distmini(Draw_Interpretor& di, Standard_Integer n, const char** a) -{ - Standard_Integer i1; - // gp_Pnt P; - - if (n != 4) return 1; +{ + if (n != 4 && n != 5 ) + return 1; const char *ns1 = (a[2]), *ns2 = (a[3]), *ns0 = (a[1]); - TopoDS_Shape S1(DBRep::Get(ns1)), S2(DBRep::Get(ns2)) ; - BRepExtrema_DistShapeShape dst(S1 ,S2 ); + TopoDS_Shape S1(DBRep::Get(ns1)), S2(DBRep::Get(ns2)); + + Standard_Real aDeflection = Precision::Confusion(); + if (n == 5) + aDeflection = Draw::Atoi(a[4]); + BRepExtrema_DistShapeShape dst(S1 ,S2, aDeflection); if (dst.IsDone()) { @@ -95,7 +98,7 @@ static Standard_Integer distmini(Draw_Interpretor& di, Standard_Integer n, const Draw::Set(tempd,dst.Value()); di << named << " "; - for (i1=1; i1<= dst.NbSolution(); i1++) + for (Standard_Integer i1 = 1; i1<= dst.NbSolution(); i1++) { gp_Pnt P1,P2; P1 = (dst.PointOnShape1(i1)); @@ -416,7 +419,7 @@ void BRepTest::ExtremaCommands (Draw_Interpretor& theCommands) aGroup); theCommands.Add ("distmini", - "distmini name Shape1 Shape2", + "distmini name Shape1 Shape2 [deflection]", __FILE__, distmini, aGroup); diff --git a/src/Extrema/Extrema_GenExtCC.gxx b/src/Extrema/Extrema_GenExtCC.gxx index 1b2d45a19a..63294ae1bd 100644 --- a/src/Extrema/Extrema_GenExtCC.gxx +++ b/src/Extrema/Extrema_GenExtCC.gxx @@ -250,10 +250,10 @@ void Extrema_GenExtCC::Perform() aFinder.SetFunctionalMinimalValue(0.0); // Best distance cannot be lower than 0.0. // Size computed to have cell index inside of int32 value. - const Standard_Real aCellSize = Max(anIntervals1.Upper() - anIntervals1.Lower(), - anIntervals2.Upper() - anIntervals2.Lower()) + const Standard_Real aCellSize = Max(anIntervals1.Last() - anIntervals1.First(), + anIntervals2.Last() - anIntervals2.First()) * Precision::PConfusion() / (2.0 * Sqrt(2.0)); - Extrema_CCPointsInspector anInspector(Precision::PConfusion()); + Extrema_CCPointsInspector anInspector(aCellSize); NCollection_CellFilter aFilter(aCellSize); NCollection_Vector aPnts; diff --git a/tests/bugs/moddata_3/bug27565 b/tests/bugs/moddata_3/bug27565 new file mode 100644 index 0000000000..84486ea763 --- /dev/null +++ b/tests/bugs/moddata_3/bug27565 @@ -0,0 +1,18 @@ +puts "================" +puts "OCC27565: " +puts "================" +puts "" +#################### +## [Regression to OCCT 7.0.0] Number of Intersections Is Wrong +#################### + +restore [locate_data_file bug27565.brep] a +explode a + +# Test number of solutions in a result. +set info [distmini d a_1 a_2 1.0] +if { [llength $info] != 9 } { + puts "Error : Extrema is wrong" +} else { + puts "OK: Extrema is valid" +}