grass
grass copied to clipboard
r.horizon: get rid of global variables and other refactoring
I refactored r.horizon to make it possible to extend it in the future (e.g. multiple coordinates, parallelization, etc.), including
- removing most global variables and reorganizing them into structures depending on when the variables change and when they don't, e.g. member variables in new struct OriginAngle are constant for each origin point and angle computed.
- reducing the scope of some local variables
- renaming/reorganizing some functions
- reducing the code duplication between the point and raster mode
- removing unused functions
- addressing cppcheck complaints
- adding a test comparing values of raster mode result with point mode results for couple points
I tried not do any changes that could impact results, e.g. there is still some discrepancy in how maxlength is computed for the modes.
Does this PR need to be updated following the recent changes in r.horizon?
Yes, but they are not all merged yet.
@petrasovaa I didn't see your reply last week as you directly edited my comment instead of replying.
I applaud this initiative. Could/should be done on most other modules.
Briefly find a few minor issues, commented in line.
Thank you, I applaud you reviewing this!