From: jfa Date: Mon, 26 Dec 2011 13:07:08 +0000 (+0000) Subject: Porting to OCCT development version: Standard_PI -> M_PI X-Git-Tag: V6_5_0a1~215 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=5acab3d3271d9516ca568577b1465693f5db96dd;p=modules%2Fsmesh.git Porting to OCCT development version: Standard_PI -> M_PI --- diff --git a/src/Controls/SMESH_Controls.cxx b/src/Controls/SMESH_Controls.cxx index 072aea8e1..6fa7bb2e1 100644 --- a/src/Controls/SMESH_Controls.cxx +++ b/src/Controls/SMESH_Controls.cxx @@ -18,7 +18,6 @@ // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// #include "SMESH_ControlsDef.hxx" @@ -693,7 +692,7 @@ double MinimumAngle::GetValue( const TSequenceOfXYZ& P ) aMin = Min(aMin,A0); } - return aMin * 180.0 / PI; + return aMin * 180.0 / M_PI; } double MinimumAngle::GetBadRate( double Value, int nbNodes ) const @@ -1278,12 +1277,12 @@ double Warping::ComputeA( const gp_XYZ& thePnt1, gp_XYZ N = GI.Crossed( GJ ); if ( N.Modulus() < gp::Resolution() ) - return PI / 2; + return M_PI / 2; N.Normalize(); double H = ( thePnt2 - theG ).Dot( N ); - return asin( fabs( H / L ) ) * 180. / PI; + return asin( fabs( H / L ) ) * 180. / M_PI; } double Warping::GetBadRate( double Value, int /*nbNodes*/ ) const @@ -1362,14 +1361,14 @@ double Skew::GetValue( const TSequenceOfXYZ& P ) return 0.; // Compute skew - static double PI2 = PI / 2.; + static double PI2 = M_PI / 2.; if ( P.size() == 3 ) { double A0 = fabs( PI2 - skewAngle( P( 3 ), P( 1 ), P( 2 ) ) ); double A1 = fabs( PI2 - skewAngle( P( 1 ), P( 2 ), P( 3 ) ) ); double A2 = fabs( PI2 - skewAngle( P( 2 ), P( 3 ), P( 1 ) ) ); - return Max( A0, Max( A1, A2 ) ) * 180. / PI; + return Max( A0, Max( A1, A2 ) ) * 180. / M_PI; } else { @@ -1386,7 +1385,7 @@ double Skew::GetValue( const TSequenceOfXYZ& P ) if ( A < Precision::Angular() ) return 0.; - return A * 180. / PI; + return A * 180. / M_PI; } } @@ -2586,7 +2585,7 @@ bool CoplanarFaces::IsSatisfy( long theElementId ) if (!normOK) return false; - const double radianTol = myToler * PI180; + const double radianTol = myToler * M_PI / 180.; typedef SMDS_StdIterator< const SMDS_MeshElement*, SMDS_ElemIteratorPtr > TFaceIt; std::set checkedFaces, checkedNodes; std::list faceQueue( 1, face ); diff --git a/src/SMESH/SMESH_MeshEditor.cxx b/src/SMESH/SMESH_MeshEditor.cxx index 82c4e6c02..caeb8a295 100644 --- a/src/SMESH/SMESH_MeshEditor.cxx +++ b/src/SMESH/SMESH_MeshEditor.cxx @@ -2071,7 +2071,7 @@ double getAngle(const SMDS_MeshElement * tr1, const SMDS_MeshNode * n1, const SMDS_MeshNode * n2) { - double angle = 2*PI; // bad angle + double angle = 2. * M_PI; // bad angle // get normals SMESH::Controls::TSequenceOfXYZ P1, P2; @@ -6459,7 +6459,7 @@ void SMESH_ElementSearcherImpl::findOuterBoundary(const SMDS_MeshElement* outerF continue; gp_Vec dirInF = gp_Vec( fNorm ) ^ n1n2; double angle = dirInOF.AngleWithRef( dirInF, n1n2 ); - if ( angle < 0 ) angle += 2*PI; + if ( angle < 0 ) angle += 2. * M_PI; angle2Face.insert( make_pair( angle, *face )); } if ( !angle2Face.empty() ) diff --git a/src/SMESH/SMESH_Pattern.cxx b/src/SMESH/SMESH_Pattern.cxx index f614a6709..ebd24f29c 100644 --- a/src/SMESH/SMESH_Pattern.cxx +++ b/src/SMESH/SMESH_Pattern.cxx @@ -1260,7 +1260,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] @@ -1811,7 +1811,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; diff --git a/src/SMESHGUI/SMESHGUI_ExtrusionAlongPathDlg.cxx b/src/SMESHGUI/SMESHGUI_ExtrusionAlongPathDlg.cxx index 64788a366..640b22d38 100644 --- a/src/SMESHGUI/SMESHGUI_ExtrusionAlongPathDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_ExtrusionAlongPathDlg.cxx @@ -18,13 +18,12 @@ // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// // SMESH SMESHGUI : GUI for SMESH component // File : SMESHGUI_ExtrusionAlongPathDlg.cxx // Author : Vadim SANDLER, Open CASCADE S.A.S. // SMESH includes -// + #include "SMESHGUI_ExtrusionAlongPathDlg.h" #include "SMESHGUI.h" @@ -1412,7 +1411,7 @@ SMESH::double_array_var SMESHGUI_ExtrusionAlongPathDlg::getAngles() { int j = 0; for (int i = 0; i < myAnglesList.count(); i++) { double angle = myAnglesList[i]; - anAngles[ j++ ] = angle*PI/180; + anAngles[ j++ ] = angle*M_PI/180.; } anAngles->length(j); } diff --git a/src/SMESHGUI/SMESHGUI_MultiEditDlg.cxx b/src/SMESHGUI/SMESHGUI_MultiEditDlg.cxx index bdbd591f3..ae9d178a3 100755 --- a/src/SMESHGUI/SMESHGUI_MultiEditDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_MultiEditDlg.cxx @@ -18,12 +18,11 @@ // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// // File : SMESHGUI_MultiEditDlg.cxx // Author : Sergey LITONIN, Open CASCADE S.A.S. // SMESH includes -// + #include "SMESHGUI_MultiEditDlg.h" #include "SMESHGUI.h" @@ -1207,7 +1206,7 @@ bool SMESHGUI_UnionOfTrianglesDlg::process (SMESH::SMESH_MeshEditor_ptr theEdito SMESH::SMESH_IDSource_ptr obj) { SMESH::NumericalFunctor_var aCriterion = getNumericalFunctor(); - double aMaxAngle = myMaxAngleSpin->GetValue() * PI / 180.0; + double aMaxAngle = myMaxAngleSpin->GetValue() * M_PI / 180.0; bool ok; if ( CORBA::is_nil( obj )) ok = theEditor->TriToQuad(theIds, aCriterion, aMaxAngle); diff --git a/src/SMESHGUI/SMESHGUI_RevolutionDlg.cxx b/src/SMESHGUI/SMESHGUI_RevolutionDlg.cxx index 98df2515c..65eb1ed28 100644 --- a/src/SMESHGUI/SMESHGUI_RevolutionDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_RevolutionDlg.cxx @@ -18,13 +18,12 @@ // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// // SMESH SMESHGUI : GUI for SMESH component // File : SMESHGUI_RevolutionDlg.cxx // Author : Michael ZORIN, Open CASCADE S.A.S. // SMESH includes -// + #include "SMESHGUI_RevolutionDlg.h" #include "SMESHGUI.h" @@ -498,7 +497,7 @@ bool SMESHGUI_RevolutionDlg::ClickOnApply() anAxis.vy = SpinBox_DY->GetValue(); anAxis.vz = SpinBox_DZ->GetValue(); - double anAngle = (SpinBox_Angle->GetValue())*PI/180; + double anAngle = (SpinBox_Angle->GetValue())*M_PI/180.; long aNbSteps = (long)SpinBox_NbSteps->value(); double aTolerance = SpinBox_Tolerance->GetValue(); @@ -1061,8 +1060,8 @@ void SMESHGUI_RevolutionDlg::onDisplaySimulation(bool toDisplayPreview) anAxis.vx = SpinBox_DX->GetValue(); anAxis.vy = SpinBox_DY->GetValue(); anAxis.vz = SpinBox_DZ->GetValue(); - - double anAngle = (SpinBox_Angle->GetValue())*PI/180; + + double anAngle = (SpinBox_Angle->GetValue())*M_PI/180.; long aNbSteps = (long)SpinBox_NbSteps->value(); double aTolerance = SpinBox_Tolerance->GetValue(); diff --git a/src/SMESHGUI/SMESHGUI_RotationDlg.cxx b/src/SMESHGUI/SMESHGUI_RotationDlg.cxx index afbe85ddc..f11fd3b78 100644 --- a/src/SMESHGUI/SMESHGUI_RotationDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_RotationDlg.cxx @@ -416,7 +416,7 @@ bool SMESHGUI_RotationDlg::ClickOnApply() anAxis.vy = SpinBox_DY->GetValue(); anAxis.vz = SpinBox_DZ->GetValue(); - double anAngle = (SpinBox_Angle->GetValue())*PI/180; + double anAngle = (SpinBox_Angle->GetValue())*M_PI/180.; QStringList aParameters; aParameters << SpinBox_X->text(); @@ -1087,7 +1087,7 @@ void SMESHGUI_RotationDlg::onDisplaySimulation( bool toDisplayPreview ) { anAxis.vx = SpinBox_DX->GetValue(); anAxis.vy = SpinBox_DY->GetValue(); anAxis.vz = SpinBox_DZ->GetValue(); - double anAngle = (SpinBox_Angle->GetValue())*PI/180; + double anAngle = (SpinBox_Angle->GetValue())*M_PI/180.; try { SUIT_OverrideCursor aWaitCursor; diff --git a/src/StdMeshers/StdMeshers_AutomaticLength.cxx b/src/StdMeshers/StdMeshers_AutomaticLength.cxx index 4671ecdce..7181815c7 100644 --- a/src/StdMeshers/StdMeshers_AutomaticLength.cxx +++ b/src/StdMeshers/StdMeshers_AutomaticLength.cxx @@ -18,13 +18,12 @@ // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// // SMESH SMESH : implementaion of SMESH idl descriptions // File : StdMeshers_AutomaticLength.cxx // Author : Edward AGAPOV, OCC // Module : SMESH -// + #include "StdMeshers_AutomaticLength.hxx" #include "SMESH_Mesh.hxx" @@ -117,7 +116,7 @@ namespace { */ //================================================================================ - const double a14divPI = 14. / PI; + const double a14divPI = 14. / M_PI; inline double segLength(double S0, double edgeLen, double minLen ) { @@ -399,5 +398,3 @@ bool StdMeshers_AutomaticLength::SetParametersByDefaults(const TDefaults& /*the // return true; } - - diff --git a/src/StdMeshers/StdMeshers_CompositeHexa_3D.cxx b/src/StdMeshers/StdMeshers_CompositeHexa_3D.cxx index bd303dad3..cdecd3038 100644 --- a/src/StdMeshers/StdMeshers_CompositeHexa_3D.cxx +++ b/src/StdMeshers/StdMeshers_CompositeHexa_3D.cxx @@ -15,14 +15,13 @@ // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// // SMESH SMESH : implementaion of SMESH idl descriptions // File : StdMeshers_CompositeHexa_3D.cxx // Module : SMESH // Created : Tue Nov 25 11:04:59 2008 // Author : Edward AGAPOV (eap) -// + #include "StdMeshers_CompositeHexa_3D.hxx" #include "SMDS_Mesh.hxx" @@ -800,7 +799,7 @@ bool _QuadFaceGrid::AddContinuousFace( const _QuadFaceGrid& other ) int iMyCommon; if ( mySides.Contain( otherSide, &iMyCommon ) ) { // check if normals of two faces are collinear at all vertices of a otherSide - const double angleTol = PI / 180 / 2; + const double angleTol = M_PI / 180. / 2.; int iV, nbV = otherSide.NbVertices(), nbCollinear = 0; for ( iV = 0; iV < nbV; ++iV ) { diff --git a/src/StdMeshers/StdMeshers_HexaFromSkin_3D.cxx b/src/StdMeshers/StdMeshers_HexaFromSkin_3D.cxx index 0a235e48b..9796ea997 100644 --- a/src/StdMeshers/StdMeshers_HexaFromSkin_3D.cxx +++ b/src/StdMeshers/StdMeshers_HexaFromSkin_3D.cxx @@ -15,12 +15,11 @@ // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// // File : StdMeshers_HexaFromSkin_3D.cxx // Created : Wed Jan 27 12:28:07 2010 // Author : Edward AGAPOV (eap) -// + #include "StdMeshers_HexaFromSkin_3D.hxx" #include "SMDS_VolumeOfNodes.hxx" @@ -749,7 +748,7 @@ namespace // compute angle of (sideIDir projection to pln) and (X dir of pln) gp_Vec2d sideIDirProj( sideIDir * pln.XDirection(), sideIDir * pln.YDirection()); double angle = sideIDirProj.Angle( gp::DX2d() ); - if ( angle < 0 ) angle += 2 * PI; // angle [0-2*PI] + if ( angle < 0 ) angle += 2. * M_PI; // angle [0-2*PI] angleOfSide.insert( make_pair( angle, sideI )); _DUMP_(" "<< sideI << " - side dir (" << sideIDir.X() << ", " << sideIDir.Y() << ", " << sideIDir.Z() << ")" @@ -758,8 +757,8 @@ namespace if ( nbLoadedSides == 1 ) { double angF = angleOfSide.begin()->first, angL = angleOfSide.rbegin()->first; - if ( angF > PI ) angF = 2*PI - angF; - if ( angL > PI ) angL = 2*PI - angL; + if ( angF > M_PI ) angF = 2.*M_PI - angF; + if ( angL > M_PI ) angL = 2.*M_PI - angL; foundSide = angF < angL ? angleOfSide.begin()->second : angleOfSide.rbegin()->second; } else @@ -1204,4 +1203,3 @@ bool StdMeshers_HexaFromSkin_3D::Compute(SMESH_Mesh&, const TopoDS_Shape&) { return error("Algorithm can't work with geometrical shapes"); } - diff --git a/src/StdMeshers/StdMeshers_QuadToTriaAdaptor.cxx b/src/StdMeshers/StdMeshers_QuadToTriaAdaptor.cxx index db32a5f1a..c20939f42 100644 --- a/src/StdMeshers/StdMeshers_QuadToTriaAdaptor.cxx +++ b/src/StdMeshers/StdMeshers_QuadToTriaAdaptor.cxx @@ -15,13 +15,12 @@ // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// // File : StdMeshers_QuadToTriaAdaptor.cxx // Module : SMESH // Created : Wen May 07 16:37:07 2008 // Author : Sergey KUUL (skl) -// + #include "StdMeshers_QuadToTriaAdaptor.hxx" #include "SMDS_SetIterator.hxx" @@ -110,7 +109,7 @@ namespace // Check angle between normals double angle = nI.Angle( nJ ); - bool tooClose = ( angle < 15 * PI180 ); + bool tooClose = ( angle < 15. * M_PI / 180. ); // Check if pyramids collide if ( !tooClose && baI * baJ > 0 ) @@ -1214,8 +1213,8 @@ bool StdMeshers_QuadToTriaAdaptor::Compute2ndPart(SMESH_Mesh& gp_Vec VI2(PCj,Pint); double ang1 = fabs(VN1.Angle(VI1)); double ang2 = fabs(VN2.Angle(VI2)); - double coef1 = 0.5 - (( ang1PI ) ang = ang - 2*PI; - if( ang<-PI ) ang = ang + 2*PI; + if( ang>M_PI ) ang = ang - 2.*M_PI; + if( ang<-M_PI ) ang = ang + 2.*M_PI; Angles.Append( ang ); } } @@ -528,7 +527,7 @@ bool StdMeshers_RadialQuadrangle_1D2D::Compute(SMESH_Mesh& aMesh, // a segment of line double fp, lp; Handle(Geom_Circle) aCirc = Handle(Geom_Circle)::DownCast( getCurve( CircEdge, &fp, &lp )); - if( fabs(fabs(lp-fp)-PI) > Precision::Confusion() ) { + if( fabs(fabs(lp-fp)-M_PI) > Precision::Confusion() ) { // not half of circle return error(COMPERR_BAD_SHAPE); } @@ -552,8 +551,8 @@ bool StdMeshers_RadialQuadrangle_1D2D::Compute(SMESH_Mesh& aMesh, for(; itn != theNodes.end(); itn++ ) { CNodes.push_back( (*itn).second ); double ang = (*itn).first - fang; - if( ang>PI ) ang = ang - 2*PI; - if( ang<-PI ) ang = ang + 2*PI; + if( ang>M_PI ) ang = ang - 2.*M_PI; + if( ang<-M_PI ) ang = ang + 2.*M_PI; Angles.Append( ang ); } const SMDS_MeshNode* NF = theNodes.begin()->second; @@ -690,8 +689,8 @@ bool StdMeshers_RadialQuadrangle_1D2D::Compute(SMESH_Mesh& aMesh, for(; itn != theNodes.end(); itn++ ) { CNodes.push_back( (*itn).second ); double ang = (*itn).first - fang; - if( ang>PI ) ang = ang - 2*PI; - if( ang<-PI ) ang = ang + 2*PI; + if( ang>M_PI ) ang = ang - 2.*M_PI; + if( ang<-M_PI ) ang = ang + 2.*M_PI; Angles.Append( ang ); } P1 = gp_Pnt( NF->X(), NF->Y(), NF->Z() ); @@ -1148,7 +1147,7 @@ bool StdMeshers_RadialQuadrangle_1D2D::Evaluate(SMESH_Mesh& aMesh, // a segment of line double fp, lp; Handle(Geom_Circle) aCirc = Handle(Geom_Circle)::DownCast( getCurve( CircEdge, &fp, &lp )); - if( fabs(fabs(lp-fp)-PI) > Precision::Confusion() ) { + if( fabs(fabs(lp-fp)-M_PI) > Precision::Confusion() ) { // not half of circle return error(COMPERR_BAD_SHAPE); } @@ -1286,4 +1285,3 @@ bool StdMeshers_RadialQuadrangle_1D2D::Evaluate(SMESH_Mesh& aMesh, return false; } - diff --git a/src/StdMeshers/StdMeshers_ViscousLayers.cxx b/src/StdMeshers/StdMeshers_ViscousLayers.cxx index 4952afab6..4326b4f7a 100644 --- a/src/StdMeshers/StdMeshers_ViscousLayers.cxx +++ b/src/StdMeshers/StdMeshers_ViscousLayers.cxx @@ -15,7 +15,6 @@ // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// // File : StdMeshers_ViscousLayers.cxx // Created : Wed Dec 1 15:15:34 2010 @@ -2508,8 +2507,8 @@ bool _ViscousBuilder::smoothAnalyticEdge( _SolidData& data, gp_Vec2d vec1( center, uv1 ); double uLast = vec0.Angle( vec1 ); // -PI - +PI double uMidl = vec0.Angle( vecM ); - if ( uLast < 0 ) uLast += 2*PI; // 0.0 - 2*PI - if ( uMidl < 0 ) uMidl += 2*PI; + if ( uLast < 0 ) uLast += 2.*M_PI; // 0.0 - 2*PI + if ( uMidl < 0 ) uMidl += 2.*M_PI; const bool sense = ( uMidl < uLast ); const double radius = 0.5 * ( vec0.Magnitude() + vec1.Magnitude() );