[GRASS-user] weird results from v.distance's to_angle

Hamish hamish_b at yahoo.com
Fri Jan 13 21:15:31 EST 2012


Hamish wrote:
> I'm getting some weird results from G6's v.distance
> upload=to_angle.
> before filing a bug report I thought I'd check if I'm just
> confused..
...
> [v.distance]
> to_angle: angle between the linear feature in 'to' map and
>     the positive x axis, at the location of point/centroid
>     in 'from' map, counterclockwise, in radians, which is
>     between -PI and PI inclusive
...
> these angles do not match the description of theta measured
> CCW from the +x axis ...?


looking in the code, I see a different description for what 'to_angle'
is meant to do:
#define TO_ANGLE   9	/* angle of linear feature in nearest point */


which makes the results I'm getting make a lot more sense. (angle *of*
nearest road segment, not angle *to* the nearest road segment)


the angle comes from Vect_point_on_line(), which is indeed slope of the
line at that nearest point along the line:
   \param angle pointer to angle of line in that point (radians, counter
                clockwise from x axis) or NULL

so it seems the option description change in r25176 was in err.
(now fixed in all branches)

but what is described by the alternate option description is probably
quite useful to the user, and a new option added to the module to
provide for that would be nice. (there are a few other relative-to-the
'from' map options listed as TODO in the code as well)


Hamish


More information about the grass-user mailing list