diff --git a/src/Main.hs b/src/Main.hs index 9587605..6c0d32c 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -55,6 +55,7 @@ convImage = Vec.map tosRGB' . Int.toVector corners :: [(Double, Double)] corners = (,) <$> [0, 1] <*> [0, 1] +shapeCircumference :: [Point V2 Double] -> Double shapeCircumference = Data.List.sum . map D.norm . loopOffsets . fromVertices genImage' :: Image VU G.RGB Double -> StdGen -> Int -> QDiagram SVG V2 Double Any diff --git a/src/Triangles.hs b/src/Triangles.hs index 5b2b1c8..d7bb23b 100644 --- a/src/Triangles.hs +++ b/src/Triangles.hs @@ -46,9 +46,11 @@ derivingUnbox [|toSRGBTuple|] [|fromSRGBTuple|] -borderSize = 0.05 + -- from -0.05 to 1.05 so there aren't missing/elongated triangles at the edges +borderSize = 0.05 + randomPoints :: StdGen -> [(Double, Double)] randomPoints = map (bimap toZeroToOneTuple toZeroToOneTuple) . randomRs ((0 :: Word, 0 :: Word), (maxBound, maxBound)) where @@ -64,11 +66,12 @@ combinations xs = . concat . withStrategy (parListChunk 50 rdeepseq) . map (\(x : xs) -> take 15 . sortOn (abs . uncurry distanceA) . map (x,) $ xs) - . init + . init -- last output of tails is empty list . tails $ xs where - edgeLengthThreshold = 10 + + xsLen = length xs toPlanarGraph :: forall n. (NFData n, Floating n, Ord n) => [P2 n] -> [(Point V2 n, Point V2 n)] toPlanarGraph points = @@ -122,7 +125,7 @@ voroniDiagramCorners center midpoints = where -- implicitly uses the unit vector * 8 as an infinitely long vector tangentVec = - scale 8 + scale 2 . fromDirection . rotateBy (1 / 4) $ dirBetween midpoint center