]> gitweb.michael.orlitzky.com - spline3.git/blob - src/FunctionValues.hs
Add the Cardinal and FunctionValues modules which will hopefully replace the existing...
[spline3.git] / src / FunctionValues.hs
1 module FunctionValues
2 where
3
4 import Cardinal
5
6 data FunctionValues =
7 FunctionValues { front :: Double,
8 back :: Double,
9 left :: Double,
10 right :: Double,
11 top :: Double,
12 down :: Double,
13 front_left :: Double,
14 front_right :: Double,
15 front_top :: Double,
16 front_down :: Double,
17 back_left :: Double,
18 back_right :: Double,
19 back_top :: Double,
20 back_down :: Double,
21 left_top :: Double,
22 left_down :: Double,
23 right_top :: Double,
24 right_down :: Double,
25 front_left_top :: Double,
26 front_left_down :: Double,
27 front_right_top :: Double,
28 front_right_down :: Double,
29 back_left_top :: Double,
30 back_left_down :: Double,
31 back_right_top :: Double,
32 back_right_down :: Double,
33 interior :: Double }
34 deriving (Eq, Show)
35
36 empty_values :: FunctionValues
37 empty_values =
38 FunctionValues 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
39
40 eval :: FunctionValues -> Cardinal -> Double
41 eval f F = front f
42 eval f B = back f
43 eval f L = left f
44 eval f R = right f
45 eval f T = top f
46 eval f D = down f
47 eval f (Sum x y) = (eval f x) + (eval f y)
48 eval f (Difference x y) = (eval f x) - (eval f y)
49 eval f (Product x y) = (eval f x) * (eval f y)
50 eval f (ScalarProduct x y) = x * (eval f y)