[GRASS-dev] [GRASS GIS] #2734: v.distance: 3d point inside area is classified as outside
GRASS GIS
trac at osgeo.org
Mon Sep 7 19:01:44 PDT 2015
#2734: v.distance: 3d point inside area is classified as outside
-----------------------------+-------------------------
Reporter: annakrat | Owner: grass-dev@…
Type: defect | Status: new
Priority: normal | Milestone: 7.0.2
Component: Vector | Version: svn-trunk
Keywords: v.distance, box | CPU: All
Platform: All |
-----------------------------+-------------------------
When a point is 3D and has different z coordinate than 0 and this point is
inside 2D area, v.distance reports that this point is outside the area.
The problem is in
[https://trac.osgeo.org/grass/browser/grass/trunk/vector/v.distance/distance.c#L293
distance.c], which calls
[https://trac.osgeo.org/grass/browser/grass/trunk/lib/vector/Vlib/box.c#L31
Vect_point_in_box] - the top and bottom of the area's box are 0, the z
coordinate (of the 3D point) is not.
One solution is to do something like this:
{{{
Index: distance.c
===================================================================
--- distance.c (revision 66134)
+++ distance.c (working copy)
@@ -291,7 +291,7 @@
for (i = 0; i < Points->n_points; i++) {
if (Vect_point_in_box(Points->x[i], Points->y[i],
- Points->z[i], abox)) {
+ with_z ? Points->z[i] : 0, abox)) {
int poly;
}}}
but then the comparison of doubles (0 == 0) in Vect_point_in_box might not
always work.
Or we could introduce a 2D version of the Vect_point_in_box function which
checks x and y only.
--
Ticket URL: <https://trac.osgeo.org/grass/ticket/2734>
GRASS GIS <https://grass.osgeo.org>
More information about the grass-dev
mailing list