TopoToolbox / libtopotoolbox

A C library for the analysis of digital elevation models.
https://topotoolbox.github.io/libtopotoolbox/
GNU General Public License v3.0
0 stars 3 forks source link

Return the number of flats from identifyflats #35

Closed wkearn closed 2 months ago

wkearn commented 2 months ago

Knowing how many flat pixels there are is useful for computing the costs for the gray-weighted distance transform. It is easy enough to compute this in identifyflats as flat pixels are identified, and return the number of flats from the function.

include/topotoolbox.h now indicates that identifyflats returns a ptrdiff_t.

src/identifyflats.c now increments a counter every time a flat is identified and returns that counter

test/random_dem.cpp is modified to check that the number of identified flats returned from identifyflats is equal to those identified while running the test.