MATLAB Answers

0

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

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.

Products


Release

R14SP1

1 Answer

Answer by MathWorks Support Team on 27 Jun 2009
 Accepted Answer

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:

http://www.qhull.org/html/qh-quick.htm#options

For information about the 'QJ' options, see:

http://www.qhull.org/html/qh-optq.htm#QJn

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'})

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today