QgsDerivativeFilter class

Adds the ability to calculate derivatives in x- and y-directions.

Needs to be subclassed (e.g. for slope and aspect)

Base classes

class QgsNineCellFilter
Base class for raster analysis methods that work with a 3x3 cell filter and calculate the value of each cell based on the cell value and the eight neighbour cells.

Derived classes

class QgsAspectFilter
Calculates aspect values in a window of 3x3 cells based on first order derivatives in x- and y- directions.
class QgsSlopeFilter
Calculates slope values in a window of 3x3 cells based on first order derivatives in x- and y- directions.

Public functions

auto processNineCellWindow(float* x11, float* x21, float* x31, float* x12, float* x22, float* x32, float* x13, float* x23, float* x33) -> float override
Calculates output value from nine input values.

Protected functions

auto calcFirstDerX(float* x11, float* x21, float* x31, float* x12, float* x22, float* x32, float* x13, float* x23, float* x33) -> float
Calculates the first order derivative in x-direction according to Horn (1981)
auto calcFirstDerY(float* x11, float* x21, float* x31, float* x12, float* x22, float* x32, float* x13, float* x23, float* x33) -> float
Calculates the first order derivative in y-direction according to Horn (1981)

Function documentation

float QgsDerivativeFilter::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.

Parameters
x11 surrounding cell top left
x21 surrounding cell central left
x31 surrounding cell bottom left
x12 surrounding cell top central
x22 the central cell for which the value will be calculated
x32 surrounding cell bottom central
x13 surrounding cell top right
x23 surrounding cell central right
x33 surrounding cell bottom right
Returns the calculated cell value for the central cell x22

The input values and the output value can be equal to the nodata value if not present or outside of the border. Must be implemented by subclasses.

First index of the input cell is the row, second index is the column