DesignEngrLab / MIConvexHull

A .Net fast convex hull library for 2, 3, and higher dimensions.
http://designengrlab.github.io/MIConvexHull/
MIT License
341 stars 60 forks source link

Triangulation of 4 2D points #15

Closed mc0re closed 7 years ago

mc0re commented 7 years ago

I have a weird thing going, I guess I'm doing something wrong. I ask the library to perform a Delaunay triangulation on 4 points (by the way, it's a pity it cannot do that for 3 points...). But only one cell is produced.

Input data: (0,0) (0,-2) (-0.71,-1.5) (-0.71,-0.5)

Output data contains the last 3 points, not (0,0).

And another thing - if I change the order of the last two points in the input, no cell is produced whatsoever. Does triangulation depend on the order of the points? If so, how can I determine the order in a 2D or 3D world?

triangulation - input triangulation - output

P.S. Don't bother about TestPoint3D, I project the 3D points onto a plane, and the 2D coordinates are projection coordinates.

mc0re commented 7 years ago

The exact failing data set is: (0, 0), (0, -2), (-0.70710678118654746, -1.5), (-0.70710678118654746, -0.5)

micampbell commented 7 years ago

Please see latest version (1.0.17.0911). I think this "edge case" has been fixed.

CharlesGavett commented 5 years ago

micampbell, I do not this this problem has been solved. I am using version 1.1.18.1016 and am getting the problem with the following data set: 1298, 1094 1298, 1096 1298, 1097 1298, 1098

I get this error: System.ArgumentException: 'The input data is degenerate. It appears to exist in 3 dimensions, but it is a 2 dimensional set (i.e. the point of collinear, coplanar, or co-hyperplanar.)'

micampbell commented 5 years ago

if those four points are your entire data set, then this is correct to receive this error. Note that your 4 points are making a vertical line, and you appear to be asking for the delaunay triangulation or the voronoi. The existing methods are not able to handle this degenerate case.