[GRASS-dev] Rast3d_location2coord inconsistent behavior

Sören Gebbert soerengebbert at googlemail.com
Sat Jul 19 17:11:33 PDT 2014


Hi Anna,
i have added the function Rast3d_location2coord_double() to the
raster3d library (r61282) that expects x, y and z as double values.

While doing this i discovered a really horrible bug in the coordinate
transformation for rows. The reason for this bug were wrong coordinate
tests in the raster3d library tests. Wrong indexing leaded me to wrong
northern coordinate to row conversion. This bug appeared in case that
coordinates are located exactly at the north/south border between two
voxels.

This is hopefully fixed now. It should be backported to grass7.0 as
well, after heavy testing.


Best regards
Soeren

2014-07-19 19:04 GMT+02:00 Anna Petrášová <kratochanna at gmail.com>:
> Hi,
>
> I have a question about Rast3d_location2coord [1]. It is casting the col,
> row, depth values to integer like this:
>
> (int) col
>
> instead of using
>
> (int)floor(col)
>
> as a result, col = 0.1 => col = 0 and col = -0.1 => col = 0, which doesn't
> seem correct to me. Any opinions?
>
> Thanks, Anna
>
> BTW, similar function Rast_northing_to_row from raster library returns
> double.
>
>
> [1] http://grass.osgeo.org/programming7/region_8c_source.html#l00291
>
> _______________________________________________
> grass-dev mailing list
> grass-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/grass-dev


More information about the grass-dev mailing list