Opened 15 years ago
Closed 11 years ago
#933 closed defect (fixed)
v.delaunay gives wrong z coordinate values if input data has duplicate points
Reported by: | jarim | Owned by: | |
---|---|---|---|
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)
Change History (6)
by , 15 years ago
Attachment: | v.delaunay.in_out.c.patch added |
---|
by , 15 years ago
Attachment: | in_outv2.patch added |
---|
follow-up: 2 comment:1 by , 15 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!
comment:2 by , 15 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.
patch