-
Notifications
You must be signed in to change notification settings - Fork 0
/
Movie.hs
52 lines (32 loc) · 1.11 KB
/
Movie.hs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
{-# LANGUAGE Rank2Types #-}
{-# LANGUAGE ViewPatterns #-}
{-# LANGUAGE ImpredicativeTypes #-}
module Movie where
import Prelude hiding (foldr, zipWith)
import Data.Foldable
import Math.Spline.BSpline
import Math.Spline.Knots (Knots)
import Data.Tree
import Data.Vector (fromList, Vector)
import Math
import Model
import Data.List.Zipper
import Data.Tree.Missing
import Data.Zip
type Index = Int
spline :: Knots Float -> [Pezzo Assoluto] -> BSpline Vector Punto
spline x = bSpline x . fromList . map originePezzo
type Movie = [Tree (Pezzo Assoluto)]
splines :: Knots Float -> Movie -> Tree (BSpline Vector Punto)
splines x (y:ys) = fmap (spline x) . foldr (zipWith (:)) (fmap return y) $ ys
splines x [] = error "empty movie to spline"
generaPasso :: Tree (Pezzo Assoluto) -> Tree (Pezzo Assoluto) -> Fulcrum -> Tempo Normalizzato -> Figura
generaPasso fp fa (Fulcrum s p) = let
(forw,_) = fromSelector fp s
fp' = relativizza $ fp
fa' = relativizza $ fa
in interpolazione fp' fa'
data Fulcrum = Fulcrum
{ legato :: Selector Tree Label
, fulcrum :: Punto
}