diff --git a/Code/BasicFilters/otbInverseLogPolarTransform.txx b/Code/BasicFilters/otbInverseLogPolarTransform.txx index f3b53d8550c5ca43e71dcf9d087be2e6787adc3a..21609ee85cf99953c281de538686bef6ae31066f 100644 --- a/Code/BasicFilters/otbInverseLogPolarTransform.txx +++ b/Code/BasicFilters/otbInverseLogPolarTransform.txx @@ -20,6 +20,7 @@ #include "otbInverseLogPolarTransform.h" #include "otbMacro.h" +#include "otbMath.h" namespace otb { @@ -96,7 +97,7 @@ typename InverseLogPolarTransform<TScalarType> { result[0]=(1/m_Scale[0])*vcl_asin((point[1]-m_Center[1])/rho); // degree conversion - result[0]=result[0]*(180/vcl_acos(-1.0)); + result[0]=result[0]*(180/M_PI); // Deplacing the range to [0,90], [270,360] result[0]= result[0]>0 ? result[0] : result[0]+360; // Avoiding asin indetermination @@ -132,7 +133,7 @@ InverseLogPolarTransform<TScalarType> { result[0]=(1/m_Scale[0])*vcl_asin((vector[1]-m_Center[1])/rho); // degree conversion - result[0]=result[0]*(180/vcl_acos(-1.0)); + result[0]=result[0]*(180/M_PI); // Deplacing the range to [0,90], [270,360] result[0]= result[0]>0 ? result[0] : result[0]+360; // Avoiding asin indetermination @@ -168,7 +169,7 @@ InverseLogPolarTransform<TScalarType> { result[0]=(1/m_Scale[0])*vcl_asin((vector[1]-m_Center[1])/rho); // degree conversion - result[0]=result[0]*(180/vcl_acos(-1.0)); + result[0]=result[0]*(180/M_PI); // Deplacing the range to [0,90], [270,360] result[0]= result[0]>0 ? result[0] : result[0]+360; // Avoiding vcl_asin indetermination diff --git a/Code/BasicFilters/otbLogPolarTransform.txx b/Code/BasicFilters/otbLogPolarTransform.txx index 48372a0a6ba68164c51c89b15e7e70758ab19e0d..a4880723684731eba88b7dd19b591bbc60e285c1 100644 --- a/Code/BasicFilters/otbLogPolarTransform.txx +++ b/Code/BasicFilters/otbLogPolarTransform.txx @@ -20,6 +20,7 @@ #include "otbLogPolarTransform.h" #include "otbMacro.h" +#include "otbMath.h" namespace otb { @@ -90,7 +91,7 @@ typename LogPolarTransform<TScalarType> ::TransformPoint(const InputPointType &point) const { OutputPointType result; - double theta = point[0]*m_Scale[0]*vcl_acos(-1.0)/180.0; + double theta = point[0]*m_Scale[0]*M_PI/180.0; double logRho = point[1]*m_Scale[1]; result[0]=m_Center[0]; result[1]=m_Center[1]; @@ -110,7 +111,7 @@ LogPolarTransform<TScalarType> ::TransformVector(const InputVectorType &vector) const { OutputVectorType result; - double theta = vector[0]*m_Scale[0]*vcl_acos(-1.0)/180.0; + double theta = vector[0]*m_Scale[0]*M_PI/180.0; double logRho = vector[1]*m_Scale[1]; result[0]=0.; result[1]=0.; @@ -131,7 +132,7 @@ LogPolarTransform<TScalarType> ::TransformVector(const InputVnlVectorType &vector) const { OutputVnlVectorType result; -double theta = vector[0]*m_Scale[0]*vcl_acos(-1.0)/180.0; +double theta = vector[0]*m_Scale[0]*M_PI/180.0; double logRho = vector[1]*m_Scale[1]; result[0]=0.; result[1]=0.; diff --git a/Testing/Code/BasicFilters/otbInverseLogPolarTransform.cxx b/Testing/Code/BasicFilters/otbInverseLogPolarTransform.cxx index dbae3d9c9803a8fca774a32a923e868906ddf1b0..915a2b6faac0aff68780f409eda10bc548044b38 100644 --- a/Testing/Code/BasicFilters/otbInverseLogPolarTransform.cxx +++ b/Testing/Code/BasicFilters/otbInverseLogPolarTransform.cxx @@ -18,6 +18,7 @@ #include "otbInverseLogPolarTransform.h" #include "otbMacro.h" #include <fstream> +#include "otbMath.h" int otbInverseLogPolarTransform(int argc, char* argv[]) { @@ -66,7 +67,7 @@ try if(rho>0) { pprime[0]=(1/angularStep)*vcl_asin((*it)[1]/rho); - pprime[0]=pprime[0]*(180/vcl_acos(-1.0)); + pprime[0]=pprime[0]*(180/M_PI); // Deplacing the range to [0,90], [270,360] pprime[0]= pprime[0]>0 ? pprime[0] : pprime[0]+360; // Avoiding asin indetermination diff --git a/Testing/Code/BasicFilters/otbLogPolarTransform.cxx b/Testing/Code/BasicFilters/otbLogPolarTransform.cxx index 3d97f31f0423bdeb004363c38f5ba2ada5890340..fb45310be1a97bc634b441666adca4b3c413a9d1 100644 --- a/Testing/Code/BasicFilters/otbLogPolarTransform.cxx +++ b/Testing/Code/BasicFilters/otbLogPolarTransform.cxx @@ -18,6 +18,7 @@ #include "otbLogPolarTransform.h" #include "itkPoint.h" #include "otbMacro.h" +#include "otbMath.h" #include <fstream> int otbLogPolarTransform(int argc, char* argv[]) @@ -65,7 +66,7 @@ try PointType pprime; - double theta = (*it)[0]*angularStep*vcl_acos(-1.0)/180.0; + double theta = (*it)[0]*angularStep*M_PI/180.0; double logRho = (*it)[1]*radialStep; file <<"Rho: "<<logRho<<", Theta: "<<theta<<std::endl; diff --git a/Testing/Code/Common/otbPathListToHistogramGenerator.cxx b/Testing/Code/Common/otbPathListToHistogramGenerator.cxx index 6bd3ea28bfa5855f30b39c0df4984f8df2d471fd..97170ee138e41afed7f808918d9da4f99914bd5b 100644 --- a/Testing/Code/Common/otbPathListToHistogramGenerator.cxx +++ b/Testing/Code/Common/otbPathListToHistogramGenerator.cxx @@ -24,6 +24,7 @@ #include "itkPolyLineParametricPath.h" #include "otbOrientationPathFunction.h" #include "otbPathListToHistogramGenerator.h" +#include "otbMath.h" int otbPathListToHistogramGenerator( int argc, char* argv[] ) { @@ -55,7 +56,7 @@ int otbPathListToHistogramGenerator( int argc, char* argv[] ) cindex[1]=30; pathElt->AddVertex(cindex); - float Theta = 2.0*static_cast<float>(vcl_acos(-1.))*static_cast<float>(i)/static_cast<float>(NbAngle); + float Theta = 2.0*static_cast<float>(M_PI)*static_cast<float>(i)/static_cast<float>(NbAngle); cindex[0]= 30 + vcl_cos(Theta); cindex[1]= 30 + vcl_sin(Theta); pathElt->AddVertex(cindex); diff --git a/Testing/Code/FeatureExtraction/otbBreakAngularPathListFilter.cxx b/Testing/Code/FeatureExtraction/otbBreakAngularPathListFilter.cxx index d57193c8d4e580c2f03bcb324ae1bfd73bfce469..0452a807d0c78f0f3b58f2faeae475c6612d7b44 100644 --- a/Testing/Code/FeatureExtraction/otbBreakAngularPathListFilter.cxx +++ b/Testing/Code/FeatureExtraction/otbBreakAngularPathListFilter.cxx @@ -21,6 +21,7 @@ #include "itkPolyLineParametricPath.h" #include <fstream> #include <vector> +#include "otbMath.h" int otbBreakAngularPathListFilter(int argc, char * argv[]) { @@ -104,7 +105,7 @@ int otbBreakAngularPathListFilter(int argc, char * argv[]) { - breakAngularFilter->SetMaxAngle((*itAngle)*vcl_acos(-1.0)/180.); + breakAngularFilter->SetMaxAngle((*itAngle)*M_PI/180.); breakAngularFilter->Update(); diff --git a/Testing/Code/FeatureExtraction/otbCompacityPathCircle.cxx b/Testing/Code/FeatureExtraction/otbCompacityPathCircle.cxx index 52dcdbc6dc10f9c6ce2aebbd9e2ce7a0fdfb679d..2b680aa326ca444ad1a923c81103991bb7061434 100644 --- a/Testing/Code/FeatureExtraction/otbCompacityPathCircle.cxx +++ b/Testing/Code/FeatureExtraction/otbCompacityPathCircle.cxx @@ -23,6 +23,7 @@ #include "otbCompacityPathFunction.h" #include "itkPolyLineParametricPath.h" #include "itkExceptionObject.h" +#include "otbMath.h" int otbCompacityPathCircle( int argc, char * argv[] ) { @@ -47,7 +48,7 @@ int otbCompacityPathCircle( int argc, char * argv[] ) RealType deltaTheta; RealType Rho = 100.0; - deltaTheta = 2.* vcl_acos(-1.0) / static_cast<RealType>(NbOfPoints); + deltaTheta = 2.* M_PI / static_cast<RealType>(NbOfPoints); pathElt->Initialize(); diff --git a/Testing/Code/FeatureExtraction/otbCompacityPathRectangle.cxx b/Testing/Code/FeatureExtraction/otbCompacityPathRectangle.cxx index 4d5f6a6d366934d48a0f7a87081fc22421abba86..0ad6854e91a96a1078a0d5b685cc96f07aaece80 100644 --- a/Testing/Code/FeatureExtraction/otbCompacityPathRectangle.cxx +++ b/Testing/Code/FeatureExtraction/otbCompacityPathRectangle.cxx @@ -23,6 +23,7 @@ #include "otbCompacityPathFunction.h" #include "itkPolyLineParametricPath.h" #include "itkExceptionObject.h" +#include "otbMath.h" int otbCompacityPathRectangle( int argc, char * argv[] ) { @@ -74,7 +75,7 @@ int otbCompacityPathRectangle( int argc, char * argv[] ) std::cout << "Compacity result: " << Result <<std::endl; RealType Error; - Error = vcl_abs(Result - static_cast<RealType>(vcl_acos(-1.0) * A*B / (A+B) / (A+B)) ); + Error = vcl_abs(Result - static_cast<RealType>(M_PI * A*B / (A+B) / (A+B)) ); if( Error > 1.E-9) { diff --git a/Testing/Code/FeatureExtraction/otbCompacityPathSquare.cxx b/Testing/Code/FeatureExtraction/otbCompacityPathSquare.cxx index 260110b61974d6e3356337f0c8d7c26d0d201df7..6c147e4ad725965f604e9a37a97cea121e68115d 100644 --- a/Testing/Code/FeatureExtraction/otbCompacityPathSquare.cxx +++ b/Testing/Code/FeatureExtraction/otbCompacityPathSquare.cxx @@ -23,6 +23,7 @@ #include "otbCompacityPathFunction.h" #include "itkPolyLineParametricPath.h" #include "itkExceptionObject.h" +#include "otbMath.h" int otbCompacityPathSquare( int argc, char * argv[] ) { @@ -68,7 +69,7 @@ int otbCompacityPathSquare( int argc, char * argv[] ) std::cout << "Compacity result: " << Result <<std::endl; RealType Error; - Error = vcl_abs(Result - static_cast<RealType>(vcl_acos(-1.0)/4.) ); + Error = vcl_abs(Result - static_cast<RealType>(M_PI_4) ); if( Error > 1.E-9) { diff --git a/Testing/Code/FeatureExtraction/otbLinkPathListFilter.cxx b/Testing/Code/FeatureExtraction/otbLinkPathListFilter.cxx index 67c5c8a7c13dfe0c902320a12e225ceea9183322..6c4dc51c45f14d31112451298fc04b81419b5391 100644 --- a/Testing/Code/FeatureExtraction/otbLinkPathListFilter.cxx +++ b/Testing/Code/FeatureExtraction/otbLinkPathListFilter.cxx @@ -20,6 +20,7 @@ #include "otbLinkPathListFilter.h" #include "itkPolyLineParametricPath.h" #include <fstream> +#include "otbMath.h" int otbLinkPathListFilter(int argc, char * argv[]) { @@ -30,7 +31,7 @@ int otbLinkPathListFilter(int argc, char * argv[]) { const char * outfname = argv[1]; const double distance = atof(argv[2]); - const double angle = atof(argv[3])*vcl_acos(-1.0)/180.; + const double angle = ::atof(argv[3])*M_PI/180.; typedef std::vector<double> PointsVectorType; typedef std::vector< PointsVectorType > PointsMatrixType; @@ -106,7 +107,7 @@ int otbLinkPathListFilter(int argc, char * argv[]) PathListIteratorType pathListIt = InputPathList->Begin(); file<<"Maximum distance threshold: "<<filter->GetDistanceThreshold()<< " ("<<distance<<")"<<std::endl; - file<<"Maximum angle threshold: "<<filter->GetAngularThreshold()<< " ("<<angle*180/vcl_acos(-1)<<")"<<std::endl; + file<<"Maximum angle threshold: "<<filter->GetAngularThreshold()<< " ("<<angle*180/M_PI<<")"<<std::endl; file<<"INPUT list of Path "<<": "<<std::endl; while(pathListIt!=InputPathList->End()) { diff --git a/Testing/Code/FeatureExtraction/otbOrientationPath.cxx b/Testing/Code/FeatureExtraction/otbOrientationPath.cxx index b5d78e9dde518c7ac8ae7bf3c0858b0be11c8506..830a622e56710a25a957e8fb5dc5ed42851e6d4d 100644 --- a/Testing/Code/FeatureExtraction/otbOrientationPath.cxx +++ b/Testing/Code/FeatureExtraction/otbOrientationPath.cxx @@ -20,8 +20,7 @@ #pragma warning ( disable : 4786 ) #endif -#include <math.h> - +#include "otbMath.h" #include "otbOrientationPathFunction.h" #include "itkPolyLineParametricPath.h" #include "itkExceptionObject.h" @@ -40,7 +39,7 @@ int otbOrientationPath( int argc, char * argv[] ) PathType::ContinuousIndexType cindex; PathType::Pointer pathElt = PathType::New(); - Theta *= vcl_acos(-1.0)/180.; + Theta *= M_PI/180.; pathElt->Initialize(); diff --git a/Testing/Code/FeatureExtraction/otbRoadExtractionFilter.cxx b/Testing/Code/FeatureExtraction/otbRoadExtractionFilter.cxx index 2b1b42f5f30b89ef1caf1bcec9e98b178650ffb2..904ca75f7a42a1d3a4743c39075955cf9e06eb58 100644 --- a/Testing/Code/FeatureExtraction/otbRoadExtractionFilter.cxx +++ b/Testing/Code/FeatureExtraction/otbRoadExtractionFilter.cxx @@ -25,6 +25,7 @@ #include "otbImageFileReader.h" #include "otbImageFileWriter.h" #include "otbPolyLineParametricPathWithValue.h" +#include "otbMath.h" int otbRoadExtractionFilter(int argc, char * argv[]) { @@ -60,7 +61,7 @@ int otbRoadExtractionFilter(int argc, char * argv[]) const double Alpha = ::atof(argv[7]); const double AmplitudeThreshold = ::atof(argv[8]); const double Tolerance = ::atof(argv[9]); - const double MaxAngle = ((vcl_acos(-1.)*::atof(argv[10]))/180.); + const double MaxAngle = ((M_PI*::atof(argv[10]))/180.); const double FirstMeanDistanceThreshold = ::atof(argv[11]); const double SecondMeanDistanceThreshold = ::atof(argv[12]); const double LinkAngularThreshold = ::atof(argv[13]);