]> gitweb.michael.orlitzky.com - spline3.git/blob - src/Main.hs
Rename the spline project to spline3.
[spline3.git] / src / Main.hs
1 module Main
2 where
3
4 import Cube
5 import Face
6 import Grid
7 import Misc (flatten)
8 import Point
9 import RealFunction
10 import Tetrahedron
11 import ThreeDimensional
12
13 trilinear :: [[[Double]]]
14 trilinear = [ [ [ 1, 2, 3 ],
15 [ 1, 3, 5 ],
16 [ 1, 4, 7 ] ],
17 [ [ 1, 2, 3 ],
18 [ 1, 4, 7 ],
19 [ 1, 6, 11 ] ],
20 [ [ 1, 2, 3 ],
21 [ 1, 5, 9 ],
22 [ 1, 8, 15 ]]]
23
24 zeros :: [[[Double]]]
25 zeros = [ [ [ 0, 0, 0 ],
26 [ 0, 0, 0 ],
27 [ 0, 0, 0 ] ],
28 --
29 [ [ 0, 0, 0 ],
30 [ 0, 0, 0 ],
31 [ 0, 0, 0 ] ],
32 --
33 [ [ 0, 0, 0 ],
34 [ 0, 0, 0 ],
35 [ 0, 0, 0 ]]]
36
37 dummy :: [[[Double]]]
38 dummy = [ [ [ 0, 1, 2 ],
39 [ 3, 4, 5 ],
40 [ 6, 7, 8 ] ],
41 --
42 [ [ 9, 10, 11 ],
43 [ 12, 13, 14 ],
44 [ 15, 16, 17 ] ],
45 --
46 [ [ 18, 19, 20 ],
47 [ 21, 22, 23 ],
48 [ 24, 25, 26 ]]]
49
50
51 find_point_value :: RealFunction Point
52 find_point_value p = poly p
53 where
54 g0 = make_grid 1 trilinear
55 the_cubes = flatten (cubes g0)
56 good_cubes = filter ((flip contains_point) p) the_cubes
57 target_cube = good_cubes !! 0
58 good_tets = filter ((flip contains_point) p) (tetrahedrons target_cube)
59 target_tetrahedron = good_tets !! 0
60 poly = polynomial target_tetrahedron
61
62 main :: IO ()
63 main = do
64 putStrLn $ show $ find_point_value (0,0,0)
65 putStrLn $ show $ find_point_value (1,0,0)
66 putStrLn $ show $ find_point_value (2,0,0)
67 putStrLn $ show $ find_point_value (0,1,0)
68 putStrLn $ show $ find_point_value (1,1,0)
69 putStrLn $ show $ find_point_value (2,1,0)
70 putStrLn $ show $ find_point_value (0,2,0)
71 putStrLn $ show $ find_point_value (1,2,0)
72 putStrLn $ show $ find_point_value (2,2,0)
73 putStrLn $ show $ find_point_value (0,0,1)
74 putStrLn $ show $ find_point_value (1,0,1)
75 putStrLn $ show $ find_point_value (2,0,1)
76 putStrLn $ show $ find_point_value (0,1,1)
77 putStrLn $ show $ find_point_value (1,1,1)
78 putStrLn $ show $ find_point_value (2,1,1)
79 putStrLn $ show $ find_point_value (0,2,1)
80 putStrLn $ show $ find_point_value (1,2,1)
81 putStrLn $ show $ find_point_value (2,2,1)
82 putStrLn $ show $ find_point_value (0,0,2)
83 putStrLn $ show $ find_point_value (1,0,2)
84 putStrLn $ show $ find_point_value (2,0,2)
85 putStrLn $ show $ find_point_value (0,1,2)
86 putStrLn $ show $ find_point_value (1,1,2)
87 putStrLn $ show $ find_point_value (2,1,2)
88 putStrLn $ show $ find_point_value (0,2,2)
89 putStrLn $ show $ find_point_value (1,2,2)
90 putStrLn $ show $ find_point_value (2,2,2)
91 -- let g0 = make_grid 1 trilinear
92 -- let the_cubes = flatten (cubes g0)
93 -- putStrLn $ show $ the_cubes
94 -- let p = (2, 0, 0)
95 -- let target_cubes = filter ((flip contains_point) p) the_cubes
96 -- putStrLn $ show $ target_cubes
97 -- let target_cube = (take 1 target_cubes) !! 0
98 -- putStrLn $ show $ target_cube
99 -- let target_tetrahedra = filter ((flip contains_point) p) (tetrahedrons target_cube)
100 -- let target_tetrahedron = (take 1 target_tetrahedra) !! 0
101 -- putStrLn $ show $ target_tetrahedron
102 -- let poly = polynomial target_tetrahedron
103 -- putStrLn $ show $ poly
104 -- putStrLn $ show $ poly p