JuhaHeiskala / DirectQhull.jl

MIT License
11 stars 5 forks source link

1D `Voronoi` leads to Qhull internal error #4

Closed thchr closed 1 year ago

thchr commented 1 year ago
julia> Voronoi(rand(1,8))
QH6005 qhull internal error (qh_determinate): only implemented for dimension >= 2

While executing:  | qhull v Qbb Qc Qz
Options selected for Qhull 2020.2.r 2021/09/27:
  run-id 950638957  voronoi  Qbbound-last  Qcoplanar-keep  Qz-infinity-point
  _pre-merge  _zero-centrum  Qinterior-keep  Pgood  _max-width 0.79
  Error-roundoff 8e-016  _one-merge 4e-015  Visible-distance 1.6e-015
  U-max-coplanar 1.6e-015  Width-outside 3.2e-015  _wide-facet 9.6e-015
  _maxoutside 4.8e-015
Last point added to hull was p0.
Qhull has finished constructing the hull.

At error exit:

Voronoi diagram by the convex hull of 9 points in 2-d:

  Number of Voronoi regions and at-infinity: 9
  Number of Voronoi vertices: 7

Statistics for:  | qhull v Qbb Qc Qz

  Number of points processed: 9
  Number of hyperplanes created: 16
  Number of facets in hull: 9
  Number of distance tests for qhull: 30
  CPU seconds to compute hull (after input):  0

A Qhull internal error has occurred.  Please send the input and output to
qhull_bug@qhull.org. If you can duplicate the error with logging ('T4z'), please
include the log file.
QH6187 qhull internal error (qh_errexit): either error while reporting error QH6005, or qh.NOerrexit not cleared after setjmp(). Exit program with error status 5

[process exited with code 5 (0x00000005)]
JuhaHeiskala commented 1 year ago

I think this is, because qhull itself does not work for 1-d inputs. Should add a check for 1-D input in the constructor, of course. qhull manual: "For convex hulls and halfspace intersections, Qhull may be used for 2-d up to 8-d. For Voronoi diagrams and Delaunay triangulations, Qhull may be used for 2-d up to 7-d."

JuhaHeiskala commented 1 year ago

Added assert for 1d input in master.

thchr commented 1 year ago

Wonderful, thanks for looking at this!

thchr commented 1 year ago

(Although I think, technically, a plain error would be more Julian since @asserts can be removed depending on compiler settings)

JuhaHeiskala commented 1 year ago

ah, yes, error is better. I will change it. Have been writing mostly c++ lately.