From 92e24f9d36e3ed6b0bd916e0f0513824028d475d Mon Sep 17 00:00:00 2001 From: emv Date: Thu, 22 Jan 2015 17:24:00 +0300 Subject: [PATCH] 0025722: Wrong implementation of SetFuzzyValue method The following methods void BOPAlgo_ArgumentAnalyzer::SetFuzzyValue(const Standard_Real theFuzz) void BOPAlgo_Builder::SetFuzzyValue(const Standard_Real theFuzz) void BOPAlgo_PaveFiller::SetFuzzyValue(const Standard_Real theFuzz) void BOPDS_DS::SetFuzzyValue(const Standard_Real theFuzz) void BRepAlgoAPI_BuilderAlgo::SetFuzzyValue(const Standard_Real theFuzz) void BRepAlgoAPI_Check::SetFuzzyValue(const Standard_Real theFuzz) have been corrected. Added test case bugs/modalg_5/bug25722 --- src/BOPAlgo/BOPAlgo_ArgumentAnalyzer.lxx | 4 +- src/BOPAlgo/BOPAlgo_Builder.cxx | 4 +- src/BOPAlgo/BOPAlgo_PaveFiller.cxx | 4 +- src/BOPDS/BOPDS_DS.lxx | 4 +- src/BRepAlgoAPI/BRepAlgoAPI_BuilderAlgo.cxx | 4 +- src/BRepAlgoAPI/BRepAlgoAPI_Check.cxx | 4 +- tests/bugs/modalg_5/bug25722 | 41 +++++++++++++++++++++ 7 files changed, 47 insertions(+), 18 deletions(-) create mode 100644 tests/bugs/modalg_5/bug25722 diff --git a/src/BOPAlgo/BOPAlgo_ArgumentAnalyzer.lxx b/src/BOPAlgo/BOPAlgo_ArgumentAnalyzer.lxx index 846e2968bb..8b3d30450e 100644 --- a/src/BOPAlgo/BOPAlgo_ArgumentAnalyzer.lxx +++ b/src/BOPAlgo/BOPAlgo_ArgumentAnalyzer.lxx @@ -67,9 +67,7 @@ inline Standard_Boolean& BOPAlgo_ArgumentAnalyzer::CurveOnSurfaceMode() //======================================================================= inline void BOPAlgo_ArgumentAnalyzer::SetFuzzyValue(const Standard_Real theFuzz) { - if (theFuzz > 0.) { - myFuzzyValue = theFuzz; - } + myFuzzyValue = (theFuzz < 0.) ? 0. : theFuzz; } //======================================================================= //function : FuzzyValue diff --git a/src/BOPAlgo/BOPAlgo_Builder.cxx b/src/BOPAlgo/BOPAlgo_Builder.cxx index 5307af8b22..8e7bb8f66c 100644 --- a/src/BOPAlgo/BOPAlgo_Builder.cxx +++ b/src/BOPAlgo/BOPAlgo_Builder.cxx @@ -198,9 +198,7 @@ BOPDS_PDS BOPAlgo_Builder::PDS() //======================================================================= void BOPAlgo_Builder::SetFuzzyValue(const Standard_Real theFuzz) { - if (theFuzz > 0.) { - myFuzzyValue = theFuzz; - } + myFuzzyValue = (theFuzz < 0.) ? 0. : theFuzz; } //======================================================================= //function : FuzzyValue diff --git a/src/BOPAlgo/BOPAlgo_PaveFiller.cxx b/src/BOPAlgo/BOPAlgo_PaveFiller.cxx index fa1b96c90d..b5fe4c6110 100644 --- a/src/BOPAlgo/BOPAlgo_PaveFiller.cxx +++ b/src/BOPAlgo/BOPAlgo_PaveFiller.cxx @@ -146,9 +146,7 @@ const BOPCol_ListOfShape& BOPAlgo_PaveFiller::Arguments()const //======================================================================= void BOPAlgo_PaveFiller::SetFuzzyValue(const Standard_Real theFuzz) { - if (theFuzz > 0.) { - myFuzzyValue = theFuzz; - } + myFuzzyValue = (theFuzz < 0.) ? 0. : theFuzz; } //======================================================================= //function : FuzzyValue diff --git a/src/BOPDS/BOPDS_DS.lxx b/src/BOPDS/BOPDS_DS.lxx index 61dbd2cfde..bf4ef9ce3f 100644 --- a/src/BOPDS/BOPDS_DS.lxx +++ b/src/BOPDS/BOPDS_DS.lxx @@ -139,9 +139,7 @@ inline const BOPDS_MapOfPassKey& BOPDS_DS::Interferences()const //======================================================================= inline void BOPDS_DS::SetFuzzyValue(const Standard_Real theFuzz) { - if (theFuzz > 0.) { - myFuzzyValue = theFuzz; - } + myFuzzyValue = (theFuzz < 0.) ? 0. : theFuzz; } //======================================================================= //function : FuzzyValue diff --git a/src/BRepAlgoAPI/BRepAlgoAPI_BuilderAlgo.cxx b/src/BRepAlgoAPI/BRepAlgoAPI_BuilderAlgo.cxx index 8deab8e203..64ad14a820 100644 --- a/src/BRepAlgoAPI/BRepAlgoAPI_BuilderAlgo.cxx +++ b/src/BRepAlgoAPI/BRepAlgoAPI_BuilderAlgo.cxx @@ -58,9 +58,7 @@ BRepAlgoAPI_BuilderAlgo::~BRepAlgoAPI_BuilderAlgo() //======================================================================= void BRepAlgoAPI_BuilderAlgo::SetFuzzyValue(const Standard_Real theFuzz) { - if (theFuzz > 0.) { - myFuzzyValue = theFuzz; - } + myFuzzyValue = (theFuzz < 0.) ? 0. : theFuzz; } //======================================================================= //function : FuzzyValue diff --git a/src/BRepAlgoAPI/BRepAlgoAPI_Check.cxx b/src/BRepAlgoAPI/BRepAlgoAPI_Check.cxx index 4c558a1ae6..f3f78791ba 100644 --- a/src/BRepAlgoAPI/BRepAlgoAPI_Check.cxx +++ b/src/BRepAlgoAPI/BRepAlgoAPI_Check.cxx @@ -80,9 +80,7 @@ BRepAlgoAPI_Check::~BRepAlgoAPI_Check() //======================================================================= void BRepAlgoAPI_Check::SetFuzzyValue(const Standard_Real theFuzz) { - if (theFuzz > 0.) { - myFuzzyValue = theFuzz; - } + myFuzzyValue = (theFuzz < 0.) ? 0. : theFuzz; } //======================================================================= //function : FuzzyValue diff --git a/tests/bugs/modalg_5/bug25722 b/tests/bugs/modalg_5/bug25722 new file mode 100644 index 0000000000..7f1c572ad9 --- /dev/null +++ b/tests/bugs/modalg_5/bug25722 @@ -0,0 +1,41 @@ +puts "==========" +puts "OCC25722" +puts "==========" +puts "" +################################################# +# Wrong implementation of SetFuzzyValue method +################################################# + +box b1 10 10 10 +box b2 10.0001 0 0 10 10 10 +bfuzzyvalue 0.0001 +bclearobjects +bcleartools +baddobjects b1 +baddtools b2 +bfillds +bbop r 1 +regexp {SOLID +: +([-0-9.+eE]+)} [nbshapes r] full nb_sol +if { ${nb_sol} != 1 } { + puts "Error : Result shape is WRONG because it must contains 1 solid instead of ${nb_sol}" +} else { + puts "Result shape contains ${nb_sol} solids" +} + +bfuzzyvalue 0. +box b1 10 10 10 +box b2 10.0001 0 0 10 10 10 +bclearobjects +bcleartools +baddobjects b1 +baddtools b2 +bfillds +bbop result 1 +regexp {SOLID +: +([-0-9.+eE]+)} [nbshapes result] full nb_sol +if { ${nb_sol} != 2 } { + puts "Error : Result shape is WRONG because it must contains 2 solids instead of ${nb_sol}" +} else { + puts "Result shape contains ${nb_sol} solids" +} + +set 2dviewer 1