aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYann Herklotz Grave <git@yannherklotzgrave.com>2019-02-24 15:20:03 +0000
committerYann Herklotz Grave <git@yannherklotzgrave.com>2019-02-24 15:20:03 +0000
commit436da9f2bc85459cc6517ec21ebcf6171520e019 (patch)
treef96b08c41cb41a9a7b92bfdd1136aa9430f5cf7d
parent297979e63d575be6e6b42b58c4d785ffefb994cd (diff)
downloadmedian-cut-436da9f2bc85459cc6517ec21ebcf6171520e019.tar.gz
median-cut-436da9f2bc85459cc6517ec21ebcf6171520e019.zip
Make function call clearer
-rw-r--r--src/Main.hs12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/Main.hs b/src/Main.hs
index 89ad27c..2f02cfd 100644
--- a/src/Main.hs
+++ b/src/Main.hs
@@ -121,7 +121,7 @@ add _ _ = error "Mono not supported"
totalRadiance :: [[PFMColour]] -> PFMColour
totalRadiance c = f $ f <$> c where f = foldl' add (PFMColour 0 0 0)
-recSplitGeneral
+makeRecSplit
:: (Eq a1, Num a1)
=> (PFMColour -> [[Double]] -> [[a2]] -> [[a3]])
-> (PFMColour -> Cut -> [[a3]] -> [[a3]])
@@ -129,19 +129,19 @@ recSplitGeneral
-> [[Double]]
-> [[a2]]
-> [[a3]]
-recSplitGeneral dFun _ 0 d c = dFun (PFMColour 0 0 1) d c
-recSplitGeneral dFun dCut n d c = dCut (PFMColour 1 1 1) cut a
+makeRecSplit dFun _ 0 d c = dFun (PFMColour 0 0 1) d c
+makeRecSplit dFun dCut n d c = dCut (PFMColour 1 1 1) cut a
where
cut = findSplitLine d
a = combine cut . apply nrec $ split cut c
(d1, d2) = split cut d
- nrec = bbimap (recSplitGeneral dFun dCut (n - 1)) (d1, d2)
+ nrec = bbimap (makeRecSplit dFun dCut (n - 1)) (d1, d2)
apply (f, g) (a', c') = (f a', g c')
recSplitRadiance, recSplit
:: Int -> [[Double]] -> [[PFMColour]] -> [[PFMColour]]
-recSplit = recSplitGeneral drawCentroid drawCut
-recSplitRadiance = recSplitGeneral drawCentroidBlack (\_ _ -> id)
+recSplit = makeRecSplit drawCentroid drawCut
+recSplitRadiance = makeRecSplit drawCentroidBlack (\_ _ -> id)
generateCuts
:: Show a