mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-27 00:33:48 -05:00
Fix some cast warnings, pre-calc values for speed
This commit is contained in:
parent
78a45b7db4
commit
07db3f84c4
@ -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 )
|
||||
@ -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
|
||||
{
|
||||
}
|
||||
|
||||
@ -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 ) ) ) );
|
||||
@ -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
|
||||
@ -107,6 +121,8 @@ void QgsHillshadeFilter::addExtraRasterParams( std::vector<float> ¶ms )
|
||||
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
|
||||
|
Loading…
x
Reference in New Issue
Block a user