## Why does the DELAUNAY function in MATLAB 7.0 (R14) produce an error when passed colinear points?

Asked by MathWorks Support Team

### MathWorks Support Team (view profile)

on 27 Jun 2009
Latest activity Commented on by Luke Sibbett

### Luke Sibbett (view profile)

on 16 Nov 2015
Accepted Answer by MathWorks Support Team

### MathWorks Support Team (view profile)

When I specify the following colinear points on the xy-plane:
x = [5 5 5 5 5]
y = 1:5
then try to compute the Delaunay triangulation:
tri = delaunay(x,y)
I receive the following error message:
??? qhull input error: input is less than 3-dimensional since it has the same x coordinate
While executing: | qhull d Qt Qbb Qc
Options selected for Qhull 2003.1 2003/12/30:
delaunay Qtriangulate Qbbound-last Qcoplanar-keep _pre-merge
_zero-centrum Pgood Qinterior-keep _max-width 4 Error-roundoff 6.9e-015
_one-merge 4.9e-014 Visible-distance 1.4e-014 U-coplanar-distance 1.4e-014
Width-outside 2.8e-014 _wide-facet 8.3e-014
Error in ==> delaunayn at 81
t = qhullmx(x', 'd ', opt);
Error in ==> delaunay at 49
tri = delaunayn([x(:) y(:)]);

### Tags

No tags entered yet.

### Release

R14SP1

MathWorks Support

### MathWorks Support Team (view profile)

Answer by MathWorks Support Team

### MathWorks Support Team (view profile)

on 27 Jun 2009

The DELAUNAY function in MATLAB is based on Qhull. This error message is generated by the Qhull routine. For information about Qhull, see http://www.qhull.org/.
To avoid this error, you can joggle the data by specifying the 'QJ' option to the DELAUNAY function.
tri = delaunay(x,y,{'QJ'})
For information about Qhull options, see the following URL:
For information about the 'QJ' options, see:
Note that the above command produces the following warning:
Warning: qhull precision warning:
The initial hull is narrow (cosine of min. angle is 1.0000000000000000).
A coplanar point may lead to a wide facet. Options 'QbB' (scale to unit box)
or 'Qbb' (scale last coordinate) may remove this warning. Use 'Pp' to skip
this warning. See 'Limitations' in qh-impre.htm.
As this warning indicates, you can skip this message using the command:
tri = delaunay(x,y,{'QJ','Pp'})

Laila h

on 26 Sep 2014
how nice THANX