[SciPy-Dev] PR 377: Convex hulls and Voronoi diagrams via Qhull

Pauli Virtanen pav@iki...
Sat Dec 8 08:49:34 CST 2012


08.12.2012 11:09, Matt Terry kirjoitti:
> It would be nice to be able to add points to an existing triangulation. 
> I looked into this briefly, and it looked like qhull has the needed
> functions, but it does some strange things with globals that would make
> retaining the needed data structures tricky.

I also looked at this: there's some code here:


This works fine as long as the triangulation has no geometrical

However, Qhull seems to not be really designed for this, and I so far
I've had some difficulties with this feature. For instance:

import numpy as np
from scipy.spatial import Delaunay
points = [(0,0), (0,1), (1,0), (1,1)]
tri = Delaunay(points, incremental=True, qhull_options="Qt Q11 Qz")
tri.add_points([(1, 1 + 1e-3)])
print tri.vertices

Despite the "Qt Q11" options and calling qh_triangulate, Qhull seems to
generate a non-simplical facet here, so the triangulation has to be
re-done from scratch.

Moreover, if you hit a case in which Qhull makes a longjmp() out from
the middle of the code (or, aborts the process, if error handling is not
enabled), the internal state is apparently left inconsistent.
Interestingly, this seems to also happens in qh_new_qhull, so in fact
the Qhull code probably leaks memory on failures.

Pauli Virtanen

More information about the SciPy-Dev mailing list