Salome HOME
Merge from V6_5_BR 05/06/2012
[modules/smesh.git] / src / SMESH / SMESH_Pattern.cxx
index ba49c219f5545cafc543490f77ced07cc5031bad..cc493ca3439cfed759fbb3153f1a8a1518d2ecb1 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2011  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
 //
 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@@ -23,7 +23,7 @@
 // File      : SMESH_Pattern.hxx
 // Created   : Mon Aug  2 10:30:00 2004
 // Author    : Edward AGAPOV (eap)
-//
+
 #include "SMESH_Pattern.hxx"
 
 #include <BRepAdaptor_Curve.hxx>
@@ -74,6 +74,8 @@
 #include "SMESH_MesherHelper.hxx"
 #include "SMESH_subMesh.hxx"
 
+#include <Basics_OCCTVersion.hxx>
+
 #include <Basics_Utils.hxx>
 #include "utilities.h"
 
@@ -444,8 +446,13 @@ static gp_XY project (const SMDS_MeshNode* theNode,
   }
   double u, v, minVal = DBL_MAX;
   for ( int i = theProjectorPS.NbExt(); i > 0; i-- )
+#if OCC_VERSION_LARGE > 0x06040000 // Porting to OCCT6.5.1
+    if ( theProjectorPS.SquareDistance( i ) < minVal ) {
+      minVal = theProjectorPS.SquareDistance( i );
+#else
     if ( theProjectorPS.Value( i ) < minVal ) {
       minVal = theProjectorPS.Value( i );
+#endif
       theProjectorPS.Point( i ).Parameter( u, v );
     }
   return gp_XY( u, v );
@@ -1254,7 +1261,7 @@ static bool checkQuads (const TIsoNode* node,
         maxLen2 = Max( maxLen2, ( n[1]->myUV - n[2]->myUV ).SquareModulus() );
       }
       maxLen2 = Max( maxLen2, ( n[2]->myUV - node->myUV ).SquareModulus() );
-      minDiag = sqrt( maxLen2 ) * PI / 60.; // ~ maxLen * Sin( 3 deg )
+      minDiag = sqrt( maxLen2 ) * M_PI / 60.; // ~ maxLen * Sin( 3 deg )
     }
 
     // check if newUV is behind 3 dirs: n[0]-n[1], n[1]-n[2] and n[0]-n[2]
@@ -1805,7 +1812,7 @@ bool SMESH_Pattern::
     double initAngle = initTgt1.Angle( initTgt2 );
     double angle = node->myDir[0].Angle( node->myDir[1] );
     if ( reversed ) angle = -angle;
-    if ( initAngle > angle && initAngle - angle > PI / 2.1 ) {
+    if ( initAngle > angle && initAngle - angle > M_PI / 2.1 ) {
       // find a close internal node
       TIsoNode* nClose = 0;
       list< TIsoNode* > testNodes;
@@ -3884,7 +3891,7 @@ void SMESH_Pattern::clearMesh(SMESH_Mesh* theMesh) const
 //           coordinates computed by either of Apply...() methods
 // WARNING : StdMeshers_Projection_... relies on MakeMesh() behavior: that
 //           it does not care of nodes and elements already existing on
-//           subshapes. DO NOT MERGE them or modify also StdMeshers_Projection_..
+//           sub-shapes. DO NOT MERGE them or modify also StdMeshers_Projection_..
 //=======================================================================
 
 bool SMESH_Pattern::MakeMesh(SMESH_Mesh* theMesh,