24 , mLightAzimuth( lightAzimuth )
25 , mLightAngle( lightAngle )
30 float *x12,
float *x22,
float *x32,
31 float *x13,
float *x23,
float *x33 )
33 float derX =
calcFirstDerX( x11, x21, x31, x12, x22, x32, x13, x23, x33 );
34 float derY =
calcFirstDerY( x11, x21, x31, x12, x22, x32, x13, x23, x33 );
41 float zenith_rad = mLightAngle * M_PI / 180.0;
42 float slope_rad = std::atan( std::sqrt( derX * derX + derY * derY ) );
43 float azimuth_rad = mLightAzimuth * M_PI / 180.0;
45 if ( derX == 0 && derY == 0 )
47 aspect_rad = azimuth_rad / 2.0;
51 aspect_rad = M_PI + std::atan2( derX, derY );
53 return std::max( 0.0, 255.0 * ( ( std::cos( zenith_rad ) * std::cos( slope_rad ) ) + ( std::sin( zenith_rad ) * std::sin( slope_rad ) * std::cos( azimuth_rad - aspect_rad ) ) ) );
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)
QgsHillshadeFilter(const QString &inputFile, const QString &outputFile, const QString &outputFormat, double lightAzimuth=300, double lightAngle=40)
Adds the ability to calculate derivatives in x- and y-directions.
float mOutputNodataValue
The nodata value of the output layer.
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.