cleanup
This commit is contained in:
parent
a1337127e0
commit
8d9a69c24b
2 changed files with 8 additions and 4 deletions
|
|
@ -55,6 +55,7 @@ convImage = Vec.map tosRGB' . Int.toVector
|
||||||
corners :: [(Double, Double)]
|
corners :: [(Double, Double)]
|
||||||
corners = (,) <$> [0, 1] <*> [0, 1]
|
corners = (,) <$> [0, 1] <*> [0, 1]
|
||||||
|
|
||||||
|
shapeCircumference :: [Point V2 Double] -> Double
|
||||||
shapeCircumference = Data.List.sum . map D.norm . loopOffsets . fromVertices
|
shapeCircumference = Data.List.sum . map D.norm . loopOffsets . fromVertices
|
||||||
|
|
||||||
genImage' :: Image VU G.RGB Double -> StdGen -> Int -> QDiagram SVG V2 Double Any
|
genImage' :: Image VU G.RGB Double -> StdGen -> Int -> QDiagram SVG V2 Double Any
|
||||||
|
|
|
||||||
|
|
@ -46,9 +46,11 @@ derivingUnbox
|
||||||
[|toSRGBTuple|]
|
[|toSRGBTuple|]
|
||||||
[|fromSRGBTuple|]
|
[|fromSRGBTuple|]
|
||||||
|
|
||||||
borderSize = 0.05
|
|
||||||
|
|
||||||
-- from -0.05 to 1.05 so there aren't missing/elongated triangles at the edges
|
-- from -0.05 to 1.05 so there aren't missing/elongated triangles at the edges
|
||||||
|
borderSize = 0.05
|
||||||
|
|
||||||
randomPoints :: StdGen -> [(Double, Double)]
|
randomPoints :: StdGen -> [(Double, Double)]
|
||||||
randomPoints = map (bimap toZeroToOneTuple toZeroToOneTuple) . randomRs ((0 :: Word, 0 :: Word), (maxBound, maxBound))
|
randomPoints = map (bimap toZeroToOneTuple toZeroToOneTuple) . randomRs ((0 :: Word, 0 :: Word), (maxBound, maxBound))
|
||||||
where
|
where
|
||||||
|
|
@ -64,11 +66,12 @@ combinations xs =
|
||||||
. concat
|
. concat
|
||||||
. withStrategy (parListChunk 50 rdeepseq)
|
. withStrategy (parListChunk 50 rdeepseq)
|
||||||
. map (\(x : xs) -> take 15 . sortOn (abs . uncurry distanceA) . map (x,) $ xs)
|
. map (\(x : xs) -> take 15 . sortOn (abs . uncurry distanceA) . map (x,) $ xs)
|
||||||
. init
|
. init -- last output of tails is empty list
|
||||||
. tails
|
. tails
|
||||||
$ xs
|
$ xs
|
||||||
where
|
where
|
||||||
edgeLengthThreshold = 10
|
|
||||||
|
xsLen = length xs
|
||||||
|
|
||||||
toPlanarGraph :: forall n. (NFData n, Floating n, Ord n) => [P2 n] -> [(Point V2 n, Point V2 n)]
|
toPlanarGraph :: forall n. (NFData n, Floating n, Ord n) => [P2 n] -> [(Point V2 n, Point V2 n)]
|
||||||
toPlanarGraph points =
|
toPlanarGraph points =
|
||||||
|
|
@ -122,7 +125,7 @@ voroniDiagramCorners center midpoints =
|
||||||
where
|
where
|
||||||
-- implicitly uses the unit vector * 8 as an infinitely long vector
|
-- implicitly uses the unit vector * 8 as an infinitely long vector
|
||||||
tangentVec =
|
tangentVec =
|
||||||
scale 8
|
scale 2
|
||||||
. fromDirection
|
. fromDirection
|
||||||
. rotateBy (1 / 4)
|
. rotateBy (1 / 4)
|
||||||
$ dirBetween midpoint center
|
$ dirBetween midpoint center
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue