From f639bd224384131d5862fa68325eb1e781bfe468 Mon Sep 17 00:00:00 2001 From: Cyrille Valladeau <cyrille.valladeau@c-s.fr> Date: Wed, 8 Jul 2009 15:38:19 +0200 Subject: [PATCH] ENH : 2*CONST_PI -> 2CONST_PI --- Code/BasicFilters/otbAmplitudePhaseToRGBFunctor.h | 2 +- Code/BasicFilters/otbGaborFilterGenerator.txx | 2 +- .../otbBreakAngularPathListFilter.txx | 4 ++-- .../otbImageToSIFTKeyPointSetFilter.h | 2 +- .../otbImageToSIFTKeyPointSetFilter.txx | 10 +++++----- Code/FeatureExtraction/otbLineSegmentDetector.txx | 6 +++--- Code/FeatureExtraction/otbLinkPathListFilter.txx | 6 +++--- Code/FeatureExtraction/otbSFSTexturesFunctor.h | 2 +- Code/FeatureExtraction/otbSFSTexturesImageFilter.h | 2 +- Code/Markov/otbMRFEnergyGaussianClassification.h | 2 +- Code/Visu/otbImageWidgetCircleForm.cxx | 2 +- 11 files changed, 20 insertions(+), 20 deletions(-) diff --git a/Code/BasicFilters/otbAmplitudePhaseToRGBFunctor.h b/Code/BasicFilters/otbAmplitudePhaseToRGBFunctor.h index 9958bacb9b..8f66e738ed 100644 --- a/Code/BasicFilters/otbAmplitudePhaseToRGBFunctor.h +++ b/Code/BasicFilters/otbAmplitudePhaseToRGBFunctor.h @@ -72,7 +72,7 @@ namespace otb { // std::cout << amplitude << " - " << phase << std::endl; double hinc, sinc, vinc; - hinc=0.6/(2*CONST_PI); + hinc=0.6/(2CONST_PI); sinc=0.0; vinc=0.0; diff --git a/Code/BasicFilters/otbGaborFilterGenerator.txx b/Code/BasicFilters/otbGaborFilterGenerator.txx index 6977ed8e1e..c85d7a2140 100644 --- a/Code/BasicFilters/otbGaborFilterGenerator.txx +++ b/Code/BasicFilters/otbGaborFilterGenerator.txx @@ -74,7 +74,7 @@ GaborFilterGenerator<TPrecision> { xr = x * costheta + y * sintheta; yr = y * costheta - x * sintheta; - coef = vcl_exp(-CONST_PI*(vcl_pow(m_A*xr,2)+vcl_pow(m_B*yr,2)))*cos(2*CONST_PI*(m_U0*x+m_V0*y)+m_Phi); + coef = vcl_exp(-CONST_PI*(vcl_pow(m_A*xr,2)+vcl_pow(m_B*yr,2)))*cos(2CONST_PI*(m_U0*x+m_V0*y)+m_Phi); m_Filter.SetElement(k,coef); ++k; } diff --git a/Code/FeatureExtraction/otbBreakAngularPathListFilter.txx b/Code/FeatureExtraction/otbBreakAngularPathListFilter.txx index 6326619d7e..4dec05a02d 100644 --- a/Code/FeatureExtraction/otbBreakAngularPathListFilter.txx +++ b/Code/FeatureExtraction/otbBreakAngularPathListFilter.txx @@ -65,8 +65,8 @@ BreakAngularPathListFilter<TPath> alpha1 = vcl_atan2((pixel1[1]-pixel2[1]),(pixel1[0]-pixel2[0])); alpha2 = vcl_atan2((pixel2[1]-pixel3[1]),(pixel2[0]-pixel3[0])); - alpha1 = (alpha1 >= 0)?alpha1:(alpha1+2.*CONST_PI); - alpha2 = (alpha2 >= 0)?alpha2:(alpha2+2.*CONST_PI); + alpha1 = (alpha1 >= 0)?alpha1:(alpha1+2CONST_PI); + alpha2 = (alpha2 >= 0)?alpha2:(alpha2+2CONST_PI); if (vcl_abs(alpha1-alpha2) > static_cast<double>(maxAngle) ) { // Add Pixel 2 diff --git a/Code/FeatureExtraction/otbImageToSIFTKeyPointSetFilter.h b/Code/FeatureExtraction/otbImageToSIFTKeyPointSetFilter.h index 1ec1b7771a..ed5b9041d4 100644 --- a/Code/FeatureExtraction/otbImageToSIFTKeyPointSetFilter.h +++ b/Code/FeatureExtraction/otbImageToSIFTKeyPointSetFilter.h @@ -69,7 +69,7 @@ public: TOutputPixel resp = vcl_atan2(input[1],input[0]); if (resp<0) { - resp+=2*CONST_PI; + resp+=2CONST_PI; } return resp; diff --git a/Code/FeatureExtraction/otbImageToSIFTKeyPointSetFilter.txx b/Code/FeatureExtraction/otbImageToSIFTKeyPointSetFilter.txx index b047aeac36..4b9f34a8e6 100644 --- a/Code/FeatureExtraction/otbImageToSIFTKeyPointSetFilter.txx +++ b/Code/FeatureExtraction/otbImageToSIFTKeyPointSetFilter.txx @@ -602,7 +602,7 @@ ImageToSIFTKeyPointSetFilter<TInputImage,TOutputPointSet> double lWeightMagnitude = vcl_exp(-dist*dist/(2*lSigma*lSigma)); // Compute the histogram bin index - unsigned int lHistoIndex = static_cast<unsigned int>(vcl_floor(nbBins*lOrientation/(2*CONST_PI))); + unsigned int lHistoIndex = static_cast<unsigned int>(vcl_floor(nbBins*lOrientation/(2CONST_PI))); // Update the histogram value lHistogram[lHistoIndex] += lMagnitude*lWeightMagnitude; @@ -798,13 +798,13 @@ ImageToSIFTKeyPointSetFilter<TInputImage,TOutputPointSet> float compensatedOrientation = lIterOrientation.Get()-angle; if (compensatedOrientation<0) { - compensatedOrientation+=2*CONST_PI; + compensatedOrientation+=2CONST_PI; } - if (compensatedOrientation>=2*CONST_PI) + if (compensatedOrientation>=2CONST_PI) { - compensatedOrientation-=2*CONST_PI; + compensatedOrientation-=2CONST_PI; } - unsigned int histogramBin = static_cast<unsigned int>(vcl_floor(compensatedOrientation*nbBinsPerHistogram/(2*CONST_PI))); + unsigned int histogramBin = static_cast<unsigned int>(vcl_floor(compensatedOrientation*nbBinsPerHistogram/(2CONST_PI))); // Compute the wheight of the pixel in the histogram double lWeightMagnitude = vcl_exp(-(dist*dist)/(2*lSigma*lSigma)); diff --git a/Code/FeatureExtraction/otbLineSegmentDetector.txx b/Code/FeatureExtraction/otbLineSegmentDetector.txx index b15d33c4be..462f4980dc 100644 --- a/Code/FeatureExtraction/otbLineSegmentDetector.txx +++ b/Code/FeatureExtraction/otbLineSegmentDetector.txx @@ -600,7 +600,7 @@ LineSegmentDetector<TInputImage, TPrecision> if( diff < 0.0 ) diff = -diff; if( diff > 1.5*CONST_PI ) { - diff -= 2*CONST_PI; + diff -= 2CONST_PI; if( diff < 0.0 ) diff = -diff; } @@ -809,8 +809,8 @@ LineSegmentDetector<TInputImage, TPrecision> ::angle_diff(double a, double b) const { a -= b; - while( a <= -CONST_PI ) a += 2*CONST_PI; - while( a > CONST_PI ) a -= 2*CONST_PI; + while( a <= -CONST_PI ) a += 2CONST_PI; + while( a > CONST_PI ) a -= 2CONST_PI; if( a < 0.0 ) a = -a; return a; } diff --git a/Code/FeatureExtraction/otbLinkPathListFilter.txx b/Code/FeatureExtraction/otbLinkPathListFilter.txx index 09f6c7d41d..b5206b5e7e 100644 --- a/Code/FeatureExtraction/otbLinkPathListFilter.txx +++ b/Code/FeatureExtraction/otbLinkPathListFilter.txx @@ -238,9 +238,9 @@ LinkPathListFilter<TPath> } else { - alpha1 = (alpha1 >= 0)?alpha1:(alpha1+2.*CONST_PI); - alpha2 = (alpha2 >= 0)?alpha2:(alpha2+2.*CONST_PI); - alpha3 = (alpha3 >= 0)?alpha3:(alpha3+2.*CONST_PI); + alpha1 = (alpha1 >= 0)?alpha1:(alpha1+2CONST_PI); + alpha2 = (alpha2 >= 0)?alpha2:(alpha2+2CONST_PI); + alpha3 = (alpha3 >= 0)?alpha3:(alpha3+2CONST_PI); } bool resp = (vcl_abs(alpha1-alpha2) < static_cast<double>(m_AngularThreshold)) diff --git a/Code/FeatureExtraction/otbSFSTexturesFunctor.h b/Code/FeatureExtraction/otbSFSTexturesFunctor.h index 3c85207d64..3948996dce 100644 --- a/Code/FeatureExtraction/otbSFSTexturesFunctor.h +++ b/Code/FeatureExtraction/otbSFSTexturesFunctor.h @@ -81,7 +81,7 @@ public: void SetNumberOfDirections( unsigned int D ) { m_NumberOfDirections = D; - m_DirectionStep = 2*CONST_PI/static_cast<double>(D); + m_DirectionStep = 2CONST_PI/static_cast<double>(D); }; void SetDirectionStep( double step ){ m_DirectionStep = step; }; void SetSelectedTextures( std::vector<bool> vect ) diff --git a/Code/FeatureExtraction/otbSFSTexturesImageFilter.h b/Code/FeatureExtraction/otbSFSTexturesImageFilter.h index 061b32bb46..906eb80964 100644 --- a/Code/FeatureExtraction/otbSFSTexturesImageFilter.h +++ b/Code/FeatureExtraction/otbSFSTexturesImageFilter.h @@ -146,7 +146,7 @@ public: void SetNumberOfDirections( unsigned int D ) { this->GetFunctor().SetNumberOfDirections( D ); - double step = 2*CONST_PI/static_cast<double>(D); + double step = 2CONST_PI/static_cast<double>(D); this->GetFunctor().SetDirectionStep( step ); }; unsigned int GetNumberOfDirections() diff --git a/Code/Markov/otbMRFEnergyGaussianClassification.h b/Code/Markov/otbMRFEnergyGaussianClassification.h index 003e2d88b5..dd502bdc8a 100644 --- a/Code/Markov/otbMRFEnergyGaussianClassification.h +++ b/Code/Markov/otbMRFEnergyGaussianClassification.h @@ -79,7 +79,7 @@ public: double result = vnl_math_sqr(val1-this->m_Parameters[2*static_cast<int>(value2)]) / (2*vnl_math_sqr(this->m_Parameters[2*static_cast<int>(value2)+1])) - + vcl_log(vcl_sqrt(2*CONST_PI)*this->m_Parameters[2*static_cast<int>(value2)+1]); + + vcl_log(vcl_sqrt(2CONST_PI)*this->m_Parameters[2*static_cast<int>(value2)+1]); return static_cast<double>( result ); } diff --git a/Code/Visu/otbImageWidgetCircleForm.cxx b/Code/Visu/otbImageWidgetCircleForm.cxx index 26d27989c6..ed626e877b 100644 --- a/Code/Visu/otbImageWidgetCircleForm.cxx +++ b/Code/Visu/otbImageWidgetCircleForm.cxx @@ -55,7 +55,7 @@ ImageWidgetCircleForm { glBegin(GL_LINE_LOOP); } - for (double angle = 0;angle <= 2*CONST_PI;angle+=0.01/static_cast<double>(m_Radius)) + for (double angle = 0;angle <= 2CONST_PI;angle+=0.01/static_cast<double>(m_Radius)) { double xi = m_Center[0]+static_cast<double>(m_Radius)*vcl_sin(angle); double yi = m_Center[1]+static_cast<double>(m_Radius)*vcl_cos(angle); -- GitLab