From 07782e0ce610bd8e8cc0d4bfb150f04e4bbf2687 Mon Sep 17 00:00:00 2001 From: jgv Date: Fri, 19 Oct 2012 18:53:19 +0400 Subject: [PATCH] 0023472: BRepAlgoAPI_Section algorithm fails with exception while intersecting two faces --- src/Adaptor3d/Adaptor3d_TopolTool.cxx | 20 ++++++++++++++++---- tests/bugs/modalg/bug23472 | 22 ++++++++++++++++++++++ 2 files changed, 38 insertions(+), 4 deletions(-) create mode 100755 tests/bugs/modalg/bug23472 diff --git a/src/Adaptor3d/Adaptor3d_TopolTool.cxx b/src/Adaptor3d/Adaptor3d_TopolTool.cxx index b7861f4b58..0fea9e6f2b 100755 --- a/src/Adaptor3d/Adaptor3d_TopolTool.cxx +++ b/src/Adaptor3d/Adaptor3d_TopolTool.cxx @@ -1070,7 +1070,7 @@ void Adaptor3d_TopolTool::BSplSamplePnts(const Standard_Real theDefl, anUFlg(1) = Standard_True; anUFlg(nbsu) = Standard_True; - myNbSamplesU = 2; + //myNbSamplesU = 2; for(i = 1; i <= nbsv; ++i) { t1 = aVPars(i); j = 1; @@ -1113,7 +1113,7 @@ void Adaptor3d_TopolTool::BSplSamplePnts(const Standard_Real theDefl, if(!ok) { j = k - 1; anUFlg(j) = Standard_True; - ++myNbSamplesU; + //++myNbSamplesU; break; } @@ -1129,6 +1129,12 @@ void Adaptor3d_TopolTool::BSplSamplePnts(const Standard_Real theDefl, } } + + myNbSamplesU = 0; + for (i = 1; i <= nbsu; i++) + if (anUFlg(i) == Standard_True) + myNbSamplesU++; + if(myNbSamplesU < myMinPnts) { if(myNbSamplesU == 2) { //"uniform" distribution; @@ -1149,7 +1155,7 @@ void Adaptor3d_TopolTool::BSplSamplePnts(const Standard_Real theDefl, aVFlg(1) = Standard_True; aVFlg(nbsv) = Standard_True; - myNbSamplesV = 2; + //myNbSamplesV = 2; for(i = 1; i <= nbsu; ++i) { t1 = anUPars(i); j = 1; @@ -1191,7 +1197,7 @@ void Adaptor3d_TopolTool::BSplSamplePnts(const Standard_Real theDefl, if(!ok) { j = k - 1; aVFlg(j) = Standard_True; - ++myNbSamplesV; + //++myNbSamplesV; break; } @@ -1207,6 +1213,12 @@ void Adaptor3d_TopolTool::BSplSamplePnts(const Standard_Real theDefl, } } + + myNbSamplesV = 0; + for (i = 1; i <= nbsv; i++) + if (aVFlg(i) == Standard_True) + myNbSamplesV++; + if(myNbSamplesV < myMinPnts) { if(myNbSamplesV == 2) { //"uniform" distribution; diff --git a/tests/bugs/modalg/bug23472 b/tests/bugs/modalg/bug23472 new file mode 100755 index 0000000000..396c439e76 --- /dev/null +++ b/tests/bugs/modalg/bug23472 @@ -0,0 +1,22 @@ +puts "============" +puts "CR23472" +puts "============" +puts "" +########################################################################################################## +# BRepAlgoAPI_Section algorithm fails with exception while intersecting two faces +########################################################################################################## + +restore [locate_data_file bug23472_f1.brep] f1 +restore [locate_data_file bug23472_f2.brep] f2 + +bsection result f1 f2 -2d + +regexp {Mass +: +([-0-9.+eE]+)} [lprops result] full l + +if { $l != 0} { + puts "Error : The bsection is not valid" +} + +# Service parameters +set mass -0.1 +set m -0.1