From 138ac5300a302b54b556d9b70460016eb5ef0a31 Mon Sep 17 00:00:00 2001 From: pkv Date: Thu, 9 Apr 2015 16:26:40 +0300 Subject: [PATCH] 0024803: improve the result of v/v interference for two vertices case Changes: class BOPTools_AlgoTools - method: void BOPTools_AlgoTools::MakeVertex(BOPCol_ListOfShape& aLV, TopoDS_Vertex& aVnew) has been changed. The section for case of two vertices has been added Test case for issue CR24803 --- src/BOPTools/BOPTools_AlgoTools.cxx | 65 +++++++++++++++++++++++++--- tests/bugs/modalg_6/bug24803 | 67 +++++++++++++++++++++++++++++ 2 files changed, 127 insertions(+), 5 deletions(-) create mode 100755 tests/bugs/modalg_6/bug24803 diff --git a/src/BOPTools/BOPTools_AlgoTools.cxx b/src/BOPTools/BOPTools_AlgoTools.cxx index 5a61d53869..6b5e4c53b6 100644 --- a/src/BOPTools/BOPTools_AlgoTools.cxx +++ b/src/BOPTools/BOPTools_AlgoTools.cxx @@ -65,6 +65,7 @@ #include // #include +#include // static @@ -1496,13 +1497,67 @@ void BOPTools_AlgoTools::MakeVertex(BOPCol_ListOfShape& aLV, TopoDS_Vertex& aVnew) { Standard_Integer aNb; - Standard_Real aTi, aDi, aDmax; - gp_Pnt aPi, aP; - gp_XYZ aXYZ(0.,0.,0.), aXYZi; - BOPCol_ListIteratorOfListOfShape aIt; // aNb=aLV.Extent(); - if (aNb) { + if (!aNb) { + return; + } + // + else if (aNb==1) { + aVnew=*((TopoDS_Vertex*)(&aLV.First())); + return; + } + // + else if (aNb==2) { + Standard_Integer m, n; + Standard_Real aR[2], dR, aD, aEps; + TopoDS_Vertex aV[2]; + gp_Pnt aP[2]; + BRep_Builder aBB; + // + aEps=RealEpsilon(); + for (m=0; m= 0. + gp_Vec aVD(aP[m], aP[n]); + aD=aVD.Magnitude(); + // + if (aD<=dR || aD2) + Standard_Real aTi, aDi, aDmax; + gp_Pnt aPi, aP; + gp_XYZ aXYZ(0.,0.,0.), aXYZi; + BOPCol_ListIteratorOfListOfShape aIt; + // aIt.Initialize(aLV); for (; aIt.More(); aIt.Next()) { TopoDS_Vertex& aVi=*((TopoDS_Vertex*)(&aIt.Value())); diff --git a/tests/bugs/modalg_6/bug24803 b/tests/bugs/modalg_6/bug24803 new file mode 100755 index 0000000000..210edcc0f7 --- /dev/null +++ b/tests/bugs/modalg_6/bug24803 @@ -0,0 +1,67 @@ +puts "========" +puts "OCC24803" +puts "========" +puts "" +########################################################### +# improve the result of v/v interference for two vertices case +########################################################### + +set x1 0 +set y1 0 +set z1 0 +set tolerance1 1.0 +vertex v1 $x1 $y1 $z1 +settolerance v1 $tolerance1 + +set x2 4 +set y2 0 +set z2 0 +vertex v2 $x2 $y2 $z2 +set tolerance2 3.5 +settolerance v2 $tolerance2 + +bop v1 v2 +bopcommon res + +regexp {Tolerance +MAX=([-0-9.+eE]+)} [tolerance res] full MaxTolerance +puts "MaxTolerance=$MaxTolerance" + +set expected_MaxTolerance 4.25 +set tol_abs_MaxTolerance 0.1 +set tol_rel_MaxTolerance 0.1 +checkreal "MaxTolerance" ${MaxTolerance} ${expected_MaxTolerance} ${tol_abs_MaxTolerance} ${tol_rel_MaxTolerance} + +set info [dump res] +regexp "Tolerance : +(\[-0-9*\.+eE\]+)" $info full tolerance_res +regexp "Point 3D : +(\[-0-9*\.+eE\]+), +(\[-0-9*\.+eE\]+), +(\[-0-9*\.+eE\]+)" $info full x_res y_res z_res +puts "tolerance_res=$tolerance_res" +puts "x_res=$x_res y_res=$y_res z_res=$z_res" + +set expected_tolerance 4.25 +set tol_abs_tolerance 0.1 +set tol_rel_tolerance 0.1 +checkreal "tolerance" ${tolerance_res} ${expected_tolerance} ${tol_abs_tolerance} ${tol_rel_tolerance} + +set expected_x_res 3.25 +set tol_abs_x_res 0.1 +set tol_rel_x_res 0.1 +checkreal "x_res" ${x_res} ${expected_x_res} ${tol_abs_x_res} ${tol_rel_x_res} + +set expected_y_res 0 +set tol_abs_y_res 0.1 +set tol_rel_y_res 0.1 +checkreal "y_res" ${y_res} ${expected_y_res} ${tol_abs_y_res} ${tol_rel_y_res} + +set expected_z_res 0 +set tol_abs_z_res 0.1 +set tol_rel_z_res 0.1 +checkreal "z_res" ${z_res} ${expected_z_res} ${tol_abs_z_res} ${tol_rel_z_res} + +circle c1 $x1 $y1 $z1 $tolerance1 +circle c2 $x2 $y2 $z2 $tolerance2 +circle c_res $x_res $y_res $z_res $tolerance_res + +view 1 +X+Y 465 20 400 400 +fit + +xwd $imagedir/${test_image}.png