Косметические правки папоротника

This commit is contained in:
2024-11-10 03:22:38 +03:00
parent 21eb5db2cc
commit b1a5ce5042

View File

@@ -14,7 +14,7 @@ transformation3 (x, y) = (0.2 * x - 0.26 * y, 0.23 * x + 0.22 * y + 1.6)
transformation4 :: Point -> Point transformation4 :: Point -> Point
transformation4 (x, y) = (-0.15 * x + 0.28 * y, 0.26 * x + 0.24 * y + 0.44) transformation4 (x, y) = (-0.15 * x + 0.28 * y, 0.26 * x + 0.24 * y + 0.44)
applyTransformation :: (Ord a, Fractional a) => Point -> a -> Point applyTransformation :: Point -> Float -> Point
applyTransformation point random applyTransformation point random
| random < 0.01 = transformation1 point | random < 0.01 = transformation1 point
| random < 0.86 = transformation2 point | random < 0.86 = transformation2 point
@@ -28,10 +28,10 @@ genNextPoint point = do
barnsleyFern :: Point -> Int -> IO [Point] barnsleyFern :: Point -> Int -> IO [Point]
barnsleyFern _ 0 = return [] barnsleyFern _ 0 = return []
barnsleyFern start n = do barnsleyFern startPoint n = do
x' <- genNextPoint start x' <- genNextPoint startPoint
xs <- barnsleyFern x' (n - 1) xs <- barnsleyFern x' (n - 1)
return (start : xs) return (startPoint : xs)
main :: IO () main :: IO ()
main = do main = do