From 6e50c22c0d95851340f909c88f3178bf25088adf Mon Sep 17 00:00:00 2001 From: Yann Herklotz Grave Date: Wed, 20 Feb 2019 19:35:51 +0000 Subject: Initial files --- src/Main.hs | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 src/Main.hs (limited to 'src') diff --git a/src/Main.hs b/src/Main.hs new file mode 100644 index 0000000..0e5141a --- /dev/null +++ b/src/Main.hs @@ -0,0 +1,23 @@ +module Main where + +import qualified Data.ByteString as B +import qualified Data.Text as T +import PFM + +fixIntensity :: Int -> Int -> PFMColour -> Double +fixIntensity sizeY y (PFMColour r g b) = + sin (fromIntegral y / fromIntegral sizeY * pi) * (f r + f g + f b) / 3 + where + f = realToFrac +fixIntensity _ _ _ = error "Mono not supported" + +findSplit :: [Double] -> Int +findSplit = + +main :: IO () +main = do + im <- B.readFile "data/grace_latlong.pfm" + let grace = revColour $ parse im + let height = pfmHeight grace - 1 + let fixedIntensities = [fixIntensity height y <$> c | c <- pfmColour grace, y <- [0..height]] + -- cgit