From b6725456747bff10bbff49d47cacace4d72b719d Mon Sep 17 00:00:00 2001 From: emv Date: Mon, 20 Feb 2017 10:54:22 +0300 Subject: [PATCH] 0028473: Incorrect result of 3D offset operation in mode Complete, Join type Intersection (spike is created) Looking for inverted edges among the neutral ones while checking the offset edges on validity (BRepOffset_MakeOffset_1::FindInvalidEdges). Test cases for the issue. --- src/BRepOffset/BRepOffset_MakeOffset_1.cxx | 10 ++------- tests/offset/begin | 2 +- tests/offset/shape_type_i_c/XC1 | 5 ++--- tests/offset/shape_type_i_c/XC2 | 1 - tests/offset/shape_type_i_c/YK5 | 10 +++++++++ tests/offset/shape_type_i_c/YK6 | 10 +++++++++ tests/offset/shape_type_i_c/YK7 | 10 +++++++++ tests/offset/shape_type_i_c/YK8 | 10 +++++++++ tests/offset/shape_type_i_c/YK9 | 10 +++++++++ tests/offset/shape_type_i_c/YL1 | 10 +++++++++ tests/offset/shape_type_i_c/YL2 | 24 ++++++++++++++++++++++ 11 files changed, 89 insertions(+), 13 deletions(-) create mode 100644 tests/offset/shape_type_i_c/YK5 create mode 100644 tests/offset/shape_type_i_c/YK6 create mode 100644 tests/offset/shape_type_i_c/YK7 create mode 100644 tests/offset/shape_type_i_c/YK8 create mode 100644 tests/offset/shape_type_i_c/YK9 create mode 100644 tests/offset/shape_type_i_c/YL1 create mode 100644 tests/offset/shape_type_i_c/YL2 diff --git a/src/BRepOffset/BRepOffset_MakeOffset_1.cxx b/src/BRepOffset/BRepOffset_MakeOffset_1.cxx index 826244e819..77f34739f9 100644 --- a/src/BRepOffset/BRepOffset_MakeOffset_1.cxx +++ b/src/BRepOffset/BRepOffset_MakeOffset_1.cxx @@ -196,7 +196,6 @@ static const TopTools_DataMapOfShapeListOfShape& theOEImages, const TopTools_DataMapOfShapeListOfShape& theOEOrigins, const TopTools_DataMapOfShapeListOfShape& theEdgesOrigins, - const TopTools_IndexedDataMapOfShapeListOfShape& theDMEF, const TopTools_IndexedDataMapOfShapeListOfShape& theDMVE, const TopTools_IndexedMapOfShape& theMEdges, TopTools_MapOfShape& theMEInverted); @@ -1675,7 +1674,7 @@ void FindInvalidEdges(const TopoDS_Face& theF, // check if the edge has been inverted Standard_Boolean bInverted = !aNbE ? Standard_False : CheckInverted(aEIm, aFOr, theOEImages, theOEOrigins, - theEdgesOrigins, aDMEF, aDMVE, aMEdges, theMEInverted); + theEdgesOrigins, aDMVE, aMEdges, theMEInverted); // if (!bInverted || !aNbVOr) { theValidEdges.Add(aEIm); @@ -2162,16 +2161,11 @@ Standard_Boolean CheckInverted(const TopoDS_Edge& theEIm, const TopTools_DataMapOfShapeListOfShape& theOEImages, const TopTools_DataMapOfShapeListOfShape& theOEOrigins, const TopTools_DataMapOfShapeListOfShape& theEdgesOrigins, - const TopTools_IndexedDataMapOfShapeListOfShape& theDMEF, const TopTools_IndexedDataMapOfShapeListOfShape& theDMVE, const TopTools_IndexedMapOfShape& theMEdges, TopTools_MapOfShape& theMEInverted) { - if (theDMEF.FindFromKey(theEIm).Extent() > 1) { - return Standard_False; - } - // - // it is necessary to compare the direction from first vertex + // It is necessary to compare the direction from first vertex // to the last vertex on the original edge with the // same direction on the new edge. If the directions // will be different - the edge has been inverted. diff --git a/tests/offset/begin b/tests/offset/begin index 4308b170c2..adc2b73152 100644 --- a/tests/offset/begin +++ b/tests/offset/begin @@ -15,7 +15,7 @@ if { [info exists test_image ] == 0 } { proc OFFSETSHAPE {distance faces calcul type} { global GlobFaces set GlobFaces $faces - uplevel #0 explode s f + if {[llength $faces] > 0} {uplevel #0 explode s f} uplevel #0 offsetparameter 1e-7 $calcul $type uplevel #0 offsetload s $distance $faces uplevel #0 offsetperform result diff --git a/tests/offset/shape_type_i_c/XC1 b/tests/offset/shape_type_i_c/XC1 index 5f1185871b..60a62df0da 100644 --- a/tests/offset/shape_type_i_c/XC1 +++ b/tests/offset/shape_type_i_c/XC1 @@ -1,6 +1,5 @@ -puts "TODO OCC27414 ALL: Error: The command cannot be built" -puts "TODO OCC27414 ALL: gives an empty result" -puts "TODO OCC27414 ALL: TEST INCOMPLETE" +puts "TODO OCC27414 ALL: Error : The volume of result shape is" +puts "TODO OCC27414 ALL: Error : The area of result shape is" restore [locate_data_file bug26917_input.dom7742_trim1.brep] s diff --git a/tests/offset/shape_type_i_c/XC2 b/tests/offset/shape_type_i_c/XC2 index 4deae08b4d..08e73642de 100755 --- a/tests/offset/shape_type_i_c/XC2 +++ b/tests/offset/shape_type_i_c/XC2 @@ -1,6 +1,5 @@ puts "TODO OCC27414 ALL: Error : The volume of result shape is" puts "TODO OCC27414 ALL: Error : The area of result shape is" -puts "TODO OCC27414 ALL: is not equal to zero" restore [locate_data_file bug26917_input.dom7742_trim2.brep] s diff --git a/tests/offset/shape_type_i_c/YK5 b/tests/offset/shape_type_i_c/YK5 new file mode 100644 index 0000000000..c3b38fc3a2 --- /dev/null +++ b/tests/offset/shape_type_i_c/YK5 @@ -0,0 +1,10 @@ +restore [locate_data_file bug28473_input.brep] s + +OFFSETSHAPE 10 {} $calcul $type + +checkprops result -v 1.57511e+008 -s 2.91387e+006 + +unifysamedom result_unif result +checknbshapes result_unif -face 19 -shell 1 + +checkview -display result_unif -2d -path ${imagedir}/${test_image}.png diff --git a/tests/offset/shape_type_i_c/YK6 b/tests/offset/shape_type_i_c/YK6 new file mode 100644 index 0000000000..a09d1721de --- /dev/null +++ b/tests/offset/shape_type_i_c/YK6 @@ -0,0 +1,10 @@ +restore [locate_data_file bug28473_input.brep] s + +OFFSETSHAPE 15 {} $calcul $type + +checkprops result -v 1.72351e+008 -s 3.02233e+006 + +unifysamedom result_unif result +checknbshapes result_unif -face 19 -shell 1 + +checkview -display result_unif -2d -path ${imagedir}/${test_image}.png diff --git a/tests/offset/shape_type_i_c/YK7 b/tests/offset/shape_type_i_c/YK7 new file mode 100644 index 0000000000..9715c00d15 --- /dev/null +++ b/tests/offset/shape_type_i_c/YK7 @@ -0,0 +1,10 @@ +restore [locate_data_file bug28473_input.brep] s + +OFFSETSHAPE 20 {} $calcul $type + +checkprops result -v 1.87736e+008 -s 3.13198e+006 + +unifysamedom result_unif result +checknbshapes result_unif -face 19 -shell 1 + +checkview -display result_unif -2d -path ${imagedir}/${test_image}.png diff --git a/tests/offset/shape_type_i_c/YK8 b/tests/offset/shape_type_i_c/YK8 new file mode 100644 index 0000000000..3bf17b4eff --- /dev/null +++ b/tests/offset/shape_type_i_c/YK8 @@ -0,0 +1,10 @@ +restore [locate_data_file bug28473_input_trim.brep] s + +OFFSETSHAPE 10 {} $calcul $type + +checkprops result -v 126000 -s 16200 + +unifysamedom result_unif result +checknbshapes result_unif -face 6 -shell 1 + +checkview -display result_unif -2d -path ${imagedir}/${test_image}.png diff --git a/tests/offset/shape_type_i_c/YK9 b/tests/offset/shape_type_i_c/YK9 new file mode 100644 index 0000000000..78b3991b95 --- /dev/null +++ b/tests/offset/shape_type_i_c/YK9 @@ -0,0 +1,10 @@ +restore [locate_data_file bug28473_input_trim.brep] s + +OFFSETSHAPE 15 {} $calcul $type + +checkprops result -v 224000 -s 23200 + +unifysamedom result_unif result +checknbshapes result_unif -face 6 -shell 1 + +checkview -display result_unif -2d -path ${imagedir}/${test_image}.png diff --git a/tests/offset/shape_type_i_c/YL1 b/tests/offset/shape_type_i_c/YL1 new file mode 100644 index 0000000000..582c5fd3b9 --- /dev/null +++ b/tests/offset/shape_type_i_c/YL1 @@ -0,0 +1,10 @@ +restore [locate_data_file bug28473_input_trim.brep] s + +OFFSETSHAPE 20 {} $calcul $type + +checkprops result -v 360000 -s 31400 + +unifysamedom result_unif result +checknbshapes result_unif -face 6 -shell 1 + +checkview -display result_unif -2d -path ${imagedir}/${test_image}.png diff --git a/tests/offset/shape_type_i_c/YL2 b/tests/offset/shape_type_i_c/YL2 new file mode 100644 index 0000000000..20dc8ed3ba --- /dev/null +++ b/tests/offset/shape_type_i_c/YL2 @@ -0,0 +1,24 @@ +restore [locate_data_file bug28473_input.brep] s + +offsetparameter 1e-7 c i r +offsetload s 10 + +foreach f [explode s f] { + mksurface surf $f + set found [regexp {Axis :([-0-9.+eE]*), ([-0-9.+eE]*), ([-0-9.+eE]*)} [dump surf] full x y z] + if {$found == 0} { + continue + } + # set offset value for top faces only + if {abs($z + 1) < 1.e-7 } { + offsetonface $f 15 + } +} +offsetperform result + +checkprops result -v 1.62264e+008 -s 2.94663e+006 + +unifysamedom result_unif result +checknbshapes result_unif -face 25 -shell 1 + +checkview -display result_unif -2d -path ${imagedir}/${test_image}.png