[gdal-dev] Re: Slope in gdaldem
Joaquim Luis
jluis at ualg.pt
Thu Dec 15 22:05:09 EST 2011
>
> float pafLocalMin = afWin[0];
> float pafLocalMax = afWin[0];
>
> for ( int k = 1; k < 9; k++)
> {
> if (afWin[k] < pafLocalMin)
> {
> pafLocalMin=afWin[k];
> }
>
> if (afWin[k] > pafLocalMax)
> {
> pafLocalMax=afWin[k];
> }
>
> }
>
> key = afWin[4] - pafLocalMin;
>
> if (key < 0)
> {
> key = afWin[4] - pafLocalMax;
> }
>
Stephen
'key' can never be negative because pafLocalMin is computed from 'afWin'
alone. The min val it can have is 0, when the minimum value is the
central node itself.
Joaquim
More information about the gdal-dev
mailing list