24   , mLightAzimuth( static_cast<float>( lightAzimuth ) )
 
   25   , mLightAngle( static_cast<float>( lightAngle ) )
 
   26   , mCosZenithRad( std::cos( static_cast<float>( lightAngle * M_PI ) / 180.0f ) )
 
   27   , mSinZenithRad( std::sin( static_cast<float>( lightAngle * M_PI ) / 180.0f ) )
 
   28   , mAzimuthRad( static_cast<float>( lightAzimuth * M_PI ) / 180.0f )
 
   33     float *x12, 
float *x22, 
float *x32,
 
   34     float *x13, 
float *x23, 
float *x33 )
 
   37   float derX = 
calcFirstDerX( x11, x21, x31, x12, x22, x32, x13, x23, x33 );
 
   38   float derY = 
calcFirstDerY( x11, x21, x31, x12, x22, x32, x13, x23, x33 );
 
   45   float slope_rad = std::atan( std::sqrt( derX * derX + derY * derY ) );
 
   47   if ( derX == 0 && derY == 0 ) 
 
   49     aspect_rad = mAzimuthRad / 2.0f;
 
   53     aspect_rad = M_PI + std::atan2( derX, derY );
 
   55   return std::max( 0.0f, 255.0f * ( ( mCosZenithRad * std::cos( slope_rad ) ) +
 
   56                                     ( mSinZenithRad * std::sin( slope_rad ) *
 
   57                                       std::cos( mAzimuthRad - aspect_rad ) ) ) );
 
   62   mLightAzimuth = azimuth;
 
   63   mAzimuthRad = azimuth * 
static_cast<float>( M_PI ) / 180.0f;
 
   69   mCosZenithRad = std::cos( 
angle * 
static_cast<float>( M_PI ) / 180.0f );
 
   70   mSinZenithRad = std::sin( 
angle * 
static_cast<float>( M_PI ) / 180.0f );
 
   75 void QgsHillshadeFilter::addExtraRasterParams( std::vector<float> ¶ms )
 
   78   params.push_back( mCosZenithRad ); 
 
   79   params.push_back( mSinZenithRad ); 
 
   80   params.push_back( mAzimuthRad ); 
 
Adds the ability to calculate derivatives in x- and y-directions.
float calcFirstDerY(float *x11, float *x21, float *x31, float *x12, float *x22, float *x32, float *x13, float *x23, float *x33)
Calculates the first order derivative in y-direction according to Horn (1981)
float calcFirstDerX(float *x11, float *x21, float *x31, float *x12, float *x22, float *x32, float *x13, float *x23, float *x33)
Calculates the first order derivative in x-direction according to Horn (1981)
float processNineCellWindow(float *x11, float *x21, float *x31, float *x12, float *x22, float *x32, float *x13, float *x23, float *x33) override
Calculates output value from nine input values.
void setLightAngle(float angle)
QgsHillshadeFilter(const QString &inputFile, const QString &outputFile, const QString &outputFormat, double lightAzimuth=300, double lightAngle=40)
void setLightAzimuth(float azimuth)
float mOutputNodataValue
The nodata value of the output layer.
double ANALYSIS_EXPORT angle(QgsPoint *p1, QgsPoint *p2, QgsPoint *p3, QgsPoint *p4)
Calculates the angle between two segments (in 2 dimension, z-values are ignored)