Opened 14 years ago

Closed 10 years ago

#933 closed defect (fixed)

v.delaunay gives wrong z coordinate values if input data has duplicate points

Reported by: jarim Owned by: grass-dev@…
Priority: normal Milestone: 7.0.0
Component: Vector Version: svn-trunk
Keywords: delaunay Cc:
CPU: x86-32 Platform: All

Description

v.delaunay output triangles can have wrong z coordinate values if the input data has duplicate points in it.

The internal array of points within v.delaunay will get corrupted if at lest one duplicate point exists.

Duplicate points are removed in remove_duplicates function in in_out.c in vector/v.delaunay/. It looks like the programmer has forgot to add the handling for z coordinates. If a duplicate is found then all subsequent points will not explicitly get assigned a z coordinate, and they will implicitly have a z coordinate that belongs to another point in the input data set.

A patch for this is attached. I have only been able to do very limited testing on Linux but this seems to fix the issue that I had with my dataset.

Attachments (2)

v.delaunay.in_out.c.patch (390 bytes ) - added by jarim 14 years ago.
patch
in_outv2.patch (476 bytes ) - added by pkelly 14 years ago.

Download all attachments as: .zip

Change History (6)

by jarim, 14 years ago

Attachment: v.delaunay.in_out.c.patch added

patch

by pkelly, 14 years ago

Attachment: in_outv2.patch added

comment:1 by pkelly, 14 years ago

Well spotted - that looks to me, too, fairly obviously like a bug. I think a simpler way of removing it though would be to copy the whole site structure by assignment rather than copying the individual members across - can you try the attached patch (in_outv2.patch) as well? I guess if it was done like this in the first place then extension to support 3-D points would not have resulted in this bug!

in reply to:  1 comment:2 by jarim, 14 years ago

Replying to pkelly:

You are right, copying the whole site structure is simpler. I guess I was too focused on just solving the problem to see that.

Your patch works fine for my dataset.

comment:3 by pkelly, 14 years ago

Patch applied in r41227 (7.0), r41228 (6.5) & r41231 (6.4).

in reply to:  3 comment:4 by neteler, 10 years ago

Resolution: fixed
Status: newclosed

Replying to pkelly:

Patch applied in r41227 (7.0), r41228 (6.5) & r41231 (6.4).

Closing.

Note: See TracTickets for help on using tickets.