[GRASS-git] [OSGeo/grass] 219cb9: r.horizon: fix bug in point mode computation (#3288)

Anna Petrasova noreply at github.com
Mon Dec 11 13:18:11 PST 2023


  Branch: refs/heads/releasebranch_8_3
  Home:   https://github.com/OSGeo/grass
  Commit: 219cb98082e8fe530796278291740dadabab11c5
      https://github.com/OSGeo/grass/commit/219cb98082e8fe530796278291740dadabab11c5
  Author: Anna Petrasova <kratochanna at gmail.com>
  Date:   2023-12-11 (Mon, 11 Dec 2023)

  Changed paths:
    M raster/r.horizon/main.c
    M raster/r.horizon/testsuite/test_r_horizon.py

  Log Message:
  -----------
  r.horizon: fix bug in point mode computation (#3288)

In point mode, some variables were not set properly, leading to major errors. Whenever it entered https://github.com/OSGeo/grass/blob/main/raster/r.horizon/main.c#L940 condition, it resulted in an error due to global variables sinangle and cosangle equal to 0. Raster mode was fine, those variables are initialized to proper values.

The fix uses com_par function (which was previously unused) with minor modification of its input. It sets those variables (and some others) and can be used in both modes, so now the variables in both modes should be set consistently.

The test computes horizon for an artificial, circular area (circle with z value 0 and 1000 around), so the horizon angles should be close to identical. This test would have previously resulted in zero horizon height everywhere.




More information about the grass-commit mailing list