Switch to DelaunayTriangulation.Naive

Per https://github.com/noinia/hgeometry/issues/28, occasionally
DelaunayTriangulation.DivideAndConquer loops infinitely - in this case,
I was able to consistently use the seed 127624940715530481, to generate
a dungeon which had the following room centroids:

    [ Point2 [38.5,3.5] :+ 0
    , Point2 [67.0,33.0] :+ 1
    , Point2 [46.0,45.5] :+ 2
    , Point2 [55.5,42.0] :+ 3
    , Point2 [36.0,25.0] :+ 4
    , Point2 [76.5,12.0] :+ 5
    , Point2 [29.0,26.5] :+ 6
    , Point2 [55.0,10.5] :+ 7
    ]

and cause delaunay triangulation to loop indefinitely (or at least
longer than I cared to wait for). Given the size of our graphs switching
to naive generation should be fine performance-wise, and avoids the
infinite loop.
This commit is contained in:
Griffin Smith 2020-01-19 13:19:00 -05:00
parent b6f170c02c
commit d62aba218d

View file

@ -10,7 +10,10 @@ module Xanthous.Util.Graphics
--------------------------------------------------------------------------------
import Xanthous.Prelude
--------------------------------------------------------------------------------
import qualified Algorithms.Geometry.DelaunayTriangulation.DivideAndConquer
-- https://github.com/noinia/hgeometry/issues/28
-- import qualified Algorithms.Geometry.DelaunayTriangulation.DivideAndConquer
-- as Geometry
import qualified Algorithms.Geometry.DelaunayTriangulation.Naive
as Geometry
import qualified Algorithms.Geometry.DelaunayTriangulation.Types as Geometry
import Codec.Picture (imagePixels)