Salome HOME
Mantis issues 0020573 and 0020603: Partition problems. A fix by Peter KURNEV.
[modules/geom.git] / src / PARTITION / Partition_Inter2d.cxx
index 54b25e6e99198d4ba6b7a3d5e80d8a589295b2aa..4469bb5b8f664d02de7404dba51c5042c823e5e6 100644 (file)
@@ -1,7 +1,7 @@
-//  GEOM PARTITION : partition algorithm
+//  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
 //
-//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R& D, LEG, PRINCIPIA R& D, BUREAU VERITAS
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
 //
 //  This library is free software; you can redistribute it and/or
 //  modify it under the terms of the GNU Lesser General Public
 //  License along with this library; if not, write to the Free Software
 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 //
-//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
-//
-//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
+//  GEOM PARTITION : partition algorithm
 //  File   : Partition_Inter2d.cxx
 //  Author : Benedicte MARTIN
 //  Module : GEOM
 //  $Header$
-
-using namespace std;
+//
 #include "Partition_Inter2d.ixx"
 
 #include "utilities.h"
@@ -58,6 +56,8 @@ static Standard_Integer NbF2d = 0;
 static Standard_Integer NbE2d = 0;
 #endif
 
+using namespace std;
+
 //=======================================================================
 //function : getOtherShape
 //purpose  :
@@ -142,7 +142,7 @@ static Standard_Boolean findVOnE(const TopoDS_Vertex &         theV,
     return Standard_False;
 
 #ifdef DEB
-  cout << "findVOnE: found MinDist = " << sqrt (MinDist2) << endl;
+  MESSAGE("findVOnE: found MinDist = " << sqrt (MinDist2));
 #endif
 
   return Standard_True;
@@ -241,11 +241,14 @@ TopoDS_Vertex Partition_Inter2d::AddVonE(const TopoDS_Vertex& theV,
 
   if (!OnE1 && !OnE2 && !theF.IsNull())
   {
-    // analitically find vertices E1 and E2 must pass trough
+    // if 3 faces intersects each others, 3 new edges on them must pass
+    // through one vertex but real intersection points of each
+    // pair of edges are sometimes more far than a tolerance.
+    // Try to analitically find vertices that E1 and E2 must pass trough
 
     TopoDS_Shape F1 = getOtherShape( theF, AsDes->Ascendant( E1 ));
     TopoDS_Shape F2 = getOtherShape( theF, AsDes->Ascendant( E2 ));
-    if (!F1.IsNull() && !F2.IsNull())
+    if (!F1.IsNull() && !F2.IsNull() && !F1.IsSame( F2 ))
     {
       OnE1 = findVOnE ( theV, E1, E2, F1, F2, AsDes, V1 );
       OnE2 = findVOnE ( theV, E2, E1, F1, F2, AsDes, V2 );