From d62aba218d1996b2c0541553c182313cfcc9843d Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Sun, 19 Jan 2020 13:19:00 -0500 Subject: 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. --- src/Xanthous/Util/Graphics.hs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/Xanthous/Util') diff --git a/src/Xanthous/Util/Graphics.hs b/src/Xanthous/Util/Graphics.hs index bd6a0906a6d5..fc704abf64fd 100644 --- a/src/Xanthous/Util/Graphics.hs +++ b/src/Xanthous/Util/Graphics.hs @@ -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) -- cgit 1.4.1