]> OCCT Git - occt.git/commitdiff
0025432: Wrong result obtained by MakerVolume operator.
authorpkv <pkv@opencascade.com>
Fri, 21 Nov 2014 10:44:01 +0000 (13:44 +0300)
committerbugmaster <bugmaster@opencascade.com>
Fri, 21 Nov 2014 10:44:45 +0000 (13:44 +0300)
Changes:
class BOPTools_AlgoTools
static function:
Standard_Boolean FindPointInFace(const TopoDS_Face& aF,
                                 const gp_Pnt& aP,
                                 gp_Dir& aDB,
                                 gp_Pnt& aPOut,
                                 Handle(IntTools_Context)& theContext,
                                 GeomAPI_ProjectPointOnSurf& aProjPL,
                                 const Standard_Real aDt,
                                 const Standard_Real aTolE)

Binormal calculation starts from the point located outside the tolerance circle of the edge

Test case for issue CR25432

Correction of test cases for issue CR25432

src/BOPTools/BOPTools_AlgoTools.cxx
tests/boolean/bcut_complex/N9
tests/boolean/bfuse_complex/P1
tests/boolean/bopcommon_complex/J1 [changed mode: 0644->0755]
tests/bugs/modalg_2/bug472_3
tests/bugs/modalg_5/bug24154
tests/bugs/modalg_5/bug25432 [new file with mode: 0644]
tests/bugs/moddata_2/bug26_1
tests/bugs/moddata_2/bug26_2

index 1594f27b243929ea0a03b01d6799bd67d027651f..f24ef626f438c9ebae1aee8fd8e0cbb87369c56d 100644 (file)
@@ -99,7 +99,8 @@ static
                                    gp_Pnt& aPOut,
                                    Handle(IntTools_Context)& theContext,
                                    GeomAPI_ProjectPointOnSurf& aProjPL,
-                                   const Standard_Real aDt);
+                                   const Standard_Real aDt,
+                                   const Standard_Real aTolE);
 static 
   Standard_Real MinStep3D(const TopoDS_Edge& theE1,
                           const TopoDS_Face& theF1,
@@ -1825,14 +1826,18 @@ void GetFaceDir(const TopoDS_Edge& aE,
                 GeomAPI_ProjectPointOnSurf& aProjPL,
                 const Standard_Real aDt)
 {
+  Standard_Real aTolE;
+  gp_Pnt aPx;
+  //
   BOPTools_AlgoTools3D::GetNormalToFaceOnEdge(aE, aF, aT, aDN);
   if (aF.Orientation()==TopAbs_REVERSED){
     aDN.Reverse();
   }
+  //
+  aTolE=BRep_Tool::Tolerance(aE); 
   aDB = aDN^aDTgt;
   //
-  gp_Pnt aPx;
-  if (!FindPointInFace(aF, aP, aDB, aPx, theContext, aProjPL, aDt)) {
+  if (!FindPointInFace(aF, aP, aDB, aPx, theContext, aProjPL, aDt, aTolE)) {
     BOPTools_AlgoTools3D::GetApproxNormalToFaceOnEdge(aE, aF, aT, aPx, 
                                                       aDN, theContext);
     aProjPL.Perform(aPx);
@@ -1841,7 +1846,6 @@ void GetFaceDir(const TopoDS_Edge& aE,
     aDB.SetXYZ(aVec.XYZ());
   }
 }
-
 //=======================================================================
 //function : FindPointInFace
 //purpose  : Find a point in the face in direction of <aDB>
@@ -1852,12 +1856,13 @@ Standard_Boolean FindPointInFace(const TopoDS_Face& aF,
                                  gp_Pnt& aPOut,
                                  Handle(IntTools_Context)& theContext,
                                  GeomAPI_ProjectPointOnSurf& aProjPL,
-                                 const Standard_Real aDt)
+                                 const Standard_Real aDt,
+                                 const Standard_Real aTolE)
 {
   Standard_Integer aNbItMax;
   Standard_Real aDist, aDTol, aPM;
   Standard_Boolean bRet;
-  gp_Pnt aP1;
+  gp_Pnt aP1, aPS;
   //
   aDTol = Precision::Angular();
   aPM = aP.XYZ().Modulus();
@@ -1869,10 +1874,27 @@ Standard_Boolean FindPointInFace(const TopoDS_Face& aF,
   //
   GeomAPI_ProjectPointOnSurf& aProj=theContext->ProjPS(aF);
   //
+  aPS=aP;
+  aProj.Perform(aPS);
+  if (!aProj.IsDone()) {
+    return bRet;
+  }
+  aPS=aProj.NearestPoint();
+  aProjPL.Perform(aPS);
+  aPS=aProjPL.NearestPoint();
+  //
+  aPS.SetXYZ(aPS.XYZ()+2.*aTolE*aDB.XYZ());
+   aProj.Perform(aPS);
+  if (!aProj.IsDone()) {
+    return bRet;
+  }
+  aPS=aProj.NearestPoint();
+  aProjPL.Perform(aPS);
+  aPS=aProjPL.NearestPoint();
+  //
+  //
   do {
-    aP1.SetCoord(aP.X()+aDt*aDB.X(),
-                 aP.Y()+aDt*aDB.Y(),
-                 aP.Z()+aDt*aDB.Z());
+    aP1.SetXYZ(aPS.XYZ()+aDt*aDB.XYZ());
     //
     aProj.Perform(aP1);
     if (!aProj.IsDone()) {
@@ -1884,7 +1906,7 @@ Standard_Boolean FindPointInFace(const TopoDS_Face& aF,
     aProjPL.Perform(aPOut);
     aPOut = aProjPL.NearestPoint();
     //
-    gp_Vec aV(aP, aPOut);
+    gp_Vec aV(aPS, aPOut);
     aDB.SetXYZ(aV.XYZ());
   } while (aDist > aDTol && --aNbItMax);
   //
@@ -2006,8 +2028,8 @@ Standard_Boolean BOPTools_AlgoTools::IsOpenShell(const TopoDS_Shell& aSh)
 //function : IsInvertedSolid
 //purpose  : 
 //=======================================================================
-Standard_Boolean 
-  BOPTools_AlgoTools::IsInvertedSolid(const TopoDS_Solid& aSolid)
+Standard_Boolean BOPTools_AlgoTools::IsInvertedSolid
+  (const TopoDS_Solid& aSolid)
 {
   Standard_Real aTolS;
   TopAbs_State aState;
index a8dbbd31892bee6bd3bf04a22af60d145754dd95..2160d785ae6598bda7dbb243a4b8c40aaccc762e 100644 (file)
@@ -1,8 +1,8 @@
 # Original bug : pro14942
 # Date : 26Aout98
 
-#CR23958 puts "TODO #22911 ALL: Faulty shapes in variables faulty_1 to faulty_"
-#CR23958 puts "TODO #22911 ALL: Error : The area of the resulting shape is"
+puts "TODO #22911 ALL: Faulty shapes in variables faulty_1 to faulty_"
+puts "TODO #22911 ALL: Error : The area of the resulting shape is"
 
 restore [locate_data_file CTO904_pro14942a.rle] a 
 restore [locate_data_file pro14942b.rle] b
index cc85ebf9696570f0fb31f60611d2c156be1b0e00..1438afa6ba627131da4d09c5ebb70930ca11364e 100644 (file)
@@ -1,4 +1,5 @@
 puts "TODO ?OCC24157 ALL: Error : The area of the resulting shape is"
+puts "TODO #22911 ALL: Faulty shapes in variables faulty_1 to faulty_"
 # cts17861
 
 restore [locate_data_file CTO900_cts17861a.rle] a
old mode 100644 (file)
new mode 100755 (executable)
index fe368bf..7ca6e58
@@ -1,3 +1,6 @@
+puts "TODO #22911 ALL: Error : The bopcommon is not valid. The area is"
+puts "TODO #22911 ALL: Error : The area of the resulting shape is"
+
 restore [locate_data_file a158] a
 restore [locate_data_file b148] b
 
index 1e67122a8751a68d0d16ecfc905e6d75ada750d9..d76522f9052ca3c1a29b71cd6c2acd9da93940ea 100755 (executable)
@@ -1,7 +1,7 @@
 #puts "TODO OCC12345 ALL: Faulty shapes in variables faulty_1 to faulty_"
 #puts "TODO OCC12345 ALL: Error : The square of result shape is"
-puts "TODO OCC12345 ALL: Error : The command is not valid"
-puts "TODO OCC12345 ALL: Error : Result shape is WRONG because it must contains"
+#puts "TODO OCC12345 ALL: Error : The command is not valid"
+#puts "TODO OCC12345 ALL: Error : Result shape is WRONG because it must contains"
 
 puts "========================"
 puts " OCC472 "
@@ -20,8 +20,8 @@ checkshape b2
 
 bfuse result b1 b2
 
-set nb_v_good 5
-set nb_e_edge 7
-set square 0
+set nb_v_good 66
+set nb_e_edge 107
+set square 31657.5
 set 2dviewer 0
 
index fe2550e50b632fc8bccdc4844afd4b77cb4908ff..abe5d0fd21613c292749d4be5ed83ce2b0a6e297 100644 (file)
@@ -12,18 +12,19 @@ restore [locate_data_file bug24154_b.brep] b2
 bop b1 b2
 bopcut result
 
-set square 2.68434e+06
+#set square 2.68434e+06
+set square 5.21269e+06
 set volume 7.35468e+07
 
 # Analysis of "nbshapes res"
 set nb_v_good 18
-set nb_e_good 27
-set nb_w_good 11
-set nb_f_good 11
+set nb_e_good 36
+set nb_w_good 18
+set nb_f_good 18
 set nb_sh_good 1
 set nb_sol_good 1
 set nb_compsol_good 0
 set nb_compound_good 1
-set nb_shape_good 70
+set nb_shape_good 93
 
 set 2dviewer 1
diff --git a/tests/bugs/modalg_5/bug25432 b/tests/bugs/modalg_5/bug25432
new file mode 100644 (file)
index 0000000..c0baa16
--- /dev/null
@@ -0,0 +1,33 @@
+puts "============"
+puts "OCC25432"
+puts "============"
+puts ""
+#########################################################################
+# Wrong result obtained by MakerVolume operator.
+#########################################################################
+
+restore [locate_data_file bug25432_qz.brep] q
+
+explode q f
+mkvolume result q_1 q_2 q_3 q_4 q_5 q_6 q_7 q_8 q_9 q_10 q_11 -ni
+
+regexp {Mass +: +([-0-9.+eE]+)} [vprops result] full volume
+
+set expected_volume 0.26776
+set tol_abs_volume 1.0e-4
+set tol_rel_volume 0.0001
+checkreal "Volume" ${volume} ${expected_volume} ${tol_abs_volume} ${tol_rel_volume}
+
+set square 3.59972
+
+set nb_v_good 12
+set nb_e_good 20
+set nb_w_good 11
+set nb_f_good 11
+set nb_sh_good 2
+set nb_sol_good 2
+set nb_compsol_good 0
+set nb_compound_good 1
+set nb_shape_good 59
+
+set 2dviewer 1
index 476c818ee8f4d9b328c8e08c86609576b1267830..9179ba8ae619ee11b7ac132855a4538b5fe7bdea 100755 (executable)
@@ -1,3 +1,5 @@
+puts "TODO CR25432 ALL: Error : The square of result shape is"
+
 puts "================"
 puts "OCC26"
 puts "================"
index ef87c178b5bc2c914299ac0defc43abd310ee58a..c9f5ec61057c8009428b56d22452d180fbfaacbb 100755 (executable)
@@ -1,3 +1,5 @@
+puts "TODO CR25432 ALL: Error : The square of result shape is"
+
 puts "================"
 puts "OCC26"
 puts "================"