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 = (,) <$> [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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue