Skip to content

Commit

Permalink
Fix some cast warnings, pre-calc values for speed
Browse files Browse the repository at this point in the history
  • Loading branch information
elpaso committed Aug 8, 2018
1 parent 78a45b7 commit 07db3f8
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/analysis/raster/qgshillshadefilter.cpp
Expand Up @@ -21,12 +21,16 @@
QgsHillshadeFilter::QgsHillshadeFilter( const QString &inputFile, const QString &outputFile, const QString &outputFormat, double lightAzimuth,
double lightAngle )
: QgsDerivativeFilter( inputFile, outputFile, outputFormat )
<<<<<<< 78a45b7db48bbf028fbb9ff9fa9690d2a596d7ef
<<<<<<< 573283f0dcf022e84bd615e84fd2656043a9722b
=======
>>>>>>> Fix some cast warnings, pre-calc values for speed
, mLightAzimuth( static_cast<float>( lightAzimuth ) )
, mLightAngle( static_cast<float>( lightAngle ) )
, mCosZenithRad( std::cos( static_cast<float>( lightAngle * M_PI ) / 180.0f ) )
, mSinZenithRad( std::sin( static_cast<float>( lightAngle * M_PI ) / 180.0f ) )
, mAzimuthRad( static_cast<float>( lightAzimuth * M_PI ) / 180.0f )
<<<<<<< 78a45b7db48bbf028fbb9ff9fa9690d2a596d7ef
=======
, mLightAzimuth( lightAzimuth )
, mLightAngle( lightAngle )
Expand All @@ -40,6 +44,8 @@ QgsHillshadeFilter::QgsHillshadeFilter( const QString &inputFile, const QString
, mSinZenithRad( std::sin( mLightAngle * M_PI / 180.0f ) )
, mAzimuthRad( mLightAzimuth * M_PI / 180.0f )
>>>>>>> [opencl] Small optimization in hillshade
=======
>>>>>>> Fix some cast warnings, pre-calc values for speed
{
}

Expand All @@ -60,17 +66,24 @@ float QgsHillshadeFilter::processNineCellWindow( float *x11, float *x21, float *
float aspect_rad = 0;
if ( derX == 0 && derY == 0 ) //aspect undefined, take a neutral value. Better solutions?
{
<<<<<<< 78a45b7db48bbf028fbb9ff9fa9690d2a596d7ef
<<<<<<< 573283f0dcf022e84bd615e84fd2656043a9722b
aspect_rad = mAzimuthRad / 2.0f;
=======
aspect_rad = mAzimuthRad / 2.0;
>>>>>>> [opencl] Fix small OpenCL alg issues
=======
aspect_rad = mAzimuthRad / 2.0f;
>>>>>>> Fix some cast warnings, pre-calc values for speed
}
else
{
aspect_rad = M_PI + std::atan2( derX, derY );
}
<<<<<<< 78a45b7db48bbf028fbb9ff9fa9690d2a596d7ef
<<<<<<< 573283f0dcf022e84bd615e84fd2656043a9722b
=======
>>>>>>> Fix some cast warnings, pre-calc values for speed
return std::max( 0.0f, 255.0f * ( ( mCosZenithRad * std::cos( slope_rad ) ) +
( mSinZenithRad * std::sin( slope_rad ) *
std::cos( mAzimuthRad - aspect_rad ) ) ) );
Expand All @@ -87,6 +100,7 @@ void QgsHillshadeFilter::setLightAngle( float angle )
mLightAngle = angle;
mCosZenithRad = std::cos( angle * static_cast<float>( M_PI ) / 180.0f );
mSinZenithRad = std::sin( angle * static_cast<float>( M_PI ) / 180.0f );
<<<<<<< 78a45b7db48bbf028fbb9ff9fa9690d2a596d7ef
}

<<<<<<< a73bbbad21629d81b9b1d4217a096a930473eb5c
Expand All @@ -107,6 +121,8 @@ void QgsHillshadeFilter::addExtraRasterParams( std::vector<float> &params )
return std::max( 0.0, 255.0 * ( ( mCosZenithRad * std::cos( slope_rad ) ) +
( mSinZenithRad * std::sin( slope_rad ) *
std::cos( mAzimuthRad - aspect_rad ) ) ) );
=======
>>>>>>> Fix some cast warnings, pre-calc values for speed
}

#ifdef HAVE_OPENCL
Expand Down

0 comments on commit 07db3f8

Please sign in to comment.