[GRASS-user] weird results from v.distance's to_angle
Moritz Lennert
mlennert at club.worldonline.be
Sun Jan 15 15:17:50 EST 2012
On 14/01/12 03:15, Hamish wrote:
> 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)
I don't really see how the 'alternate description' is different from
what you read in the code. It says:
"angle between the linear feature in 'to' map and
the positive x axis, at the location of point/centroid"
i.e. it is clearly described as the angle 'of' the line, at the point
nearest to the point/centroid in the from map...
The parameter name might be confusion, but to_angle comes from the idea
of angle of the feature in the to map, just the same as to_attr, to_x, etc.
While I'm not sure which of the to_angle descriptions I prefer (in your
version it is not unambiguously clear where the angle is measured as I
image that the 'to' feature is a line, not a line segment) I have to
admit that I prefer the descriptions in r25176 for to_along, as it makes
it clear that distance is measured from the 'start' coordinate of the
linear feature (i.e. right now we know whereto it measures, but not from
where).
Here would be my go for both of them:
"to_along;distance to the nearest point on 'from' feature along linear
feature, measured from 'start' point of that linear feature;"
"to_angle;angle of linear feature at the point nearest to point/centroid
in 'from' map, counterclockwise from positive x axis, in radians, which
is between -PI and PI inclusive;"
Moritz
More information about the grass-user
mailing list