Refactor window block

This commit is contained in:
jgk
2021-03-23 03:25:35 +01:00
parent 257e60e4e8
commit afb3d8a712
16 changed files with 151 additions and 883 deletions
+10
View File
@@ -299,6 +299,16 @@ divideLine x a b = take 5000 $ map (\i -> a +.+ (i / (fromIntegral numPoints) *.
numPoints = max 1 $ ceiling $ d / x
ns = [0 .. numPoints]
divideLineOddNumPoints :: Float -> Point2 -> Point2 -> [Point2]
--divideLine x a b = map (\i -> a +.+ (i / (fromIntegral numPoints)) *.* (b -.- a))
divideLineOddNumPoints x a b = take 5000 $ map (\i -> a +.+ (i / (fromIntegral numPoints) *.* (b -.- a)) )
$ map fromIntegral ns
where d = dist a b
numPoints' = max 1 $ ceiling $ d / x
numPoints | even numPoints' = numPoints'
| otherwise = numPoints' + 1
ns = [0 .. numPoints]
-- pulled the following from the haskell wiki
-- it seems to produce an infinite loop sometimes