[project @ 1996-07-25 21:02:03 by partain]
[nofib.git] / real / fulsom / Types.hs
1 {-
2 - Fulsom (The Solid Modeller, written in Haskell)
3 -
4 - Copyright 1990,1991,1992,1993 Duncan Sinclair
5 -
6 - Permissiom to use, copy, modify, and distribute this software for any
7 - purpose and without fee is hereby granted, provided that the above
8 - copyright notice and this permission notice appear in all copies, and
9 - that my name not be used in advertising or publicity pertaining to this
10 - software without specific, written prior permission. I makes no
11 - representations about the suitability of this software for any purpose.
12 - It is provided ``as is'' without express or implied warranty.
13 -
14 - Duncan Sinclair 1993.
15 -
16 - All major types declared here.
17 -
18 -}
19
20 module Types (
21 FType(..),
22 BI(..),Prim(..),Ops(..),Csg(..),CsgOut(..),Calc(..),
23 Color(..),
24 R3(..),R1(..),Row(..),Arr(..),
25 Oct(..),tuple,
26 Quad(..),
27 Vector(..),In(..) ) where
28
29 import Interval
30
31 ----------------------------------------------------------
32 -- Csg
33 ----------------------------------------------------------
34
35 type FType = Double
36
37 type BI = Interval FType
38
39 data Prim = Sphere FType FType FType FType
40 | Cube FType FType FType FType
41 | Plane FType FType FType FType
42 | X | Y | Z
43 deriving Show{-was:Text-}
44
45 data Ops = RotX FType
46 | RotY FType
47 | RotZ FType
48 | Scale FType FType FType
49 | Trans FType FType FType
50 deriving Show{-was:Text-}
51
52 data Csg = Object Prim
53 | Geom Csg Ops
54 | Func Calc
55 | Matrix Csg Arr
56 | Colour Color Csg
57 | Union Csg Csg
58 | Inter Csg Csg
59 | Sub Csg Csg
60 | Comp Csg
61 -- deriving Show{-was:Text-}
62
63
64 -- type CsgOut = (R1 BI,Csg,Color,Bool)
65 type CsgOut = (BI,Csg,Color,Bool)
66
67 type Calc = Color -> (R3 BI) -> CsgOut
68
69 ----------------------------------------------------------
70 -- [KC]olor
71 ----------------------------------------------------------
72
73 data Color = RGB FType FType FType
74 deriving Show{-was:Text-}
75
76 ----------------------------------------------------------
77 -- Matrix
78 ----------------------------------------------------------
79
80 type Row = (FType,FType,FType,FType)
81 type Arr = (Row,Row,Row)
82
83 -- type (Fractional a) => R3 a = (a,a,a)
84 -- type (Fractional a) => R1 a = a
85
86 type R3 a = (a,a,a)
87 -- type R1 a = a
88 type R1 a = (a,a)
89
90 ----------------------------------------------------------
91 -- Oct
92 ----------------------------------------------------------
93
94 data Oct = O_Full Color | O_Empty | O_Sub Color [Oct]
95 deriving Show{-was:Text-}
96
97 ----------------------------------------------------------
98 -- Quad
99 ----------------------------------------------------------
100
101 data Quad = Q_Empty | Q_Full Color
102 | Q_Sub Color [Quad]
103 | Q_NewXY FType FType FType
104 deriving Show{-was:Text-}
105
106 ----------------------------------------------------------
107 -- Vector
108 ----------------------------------------------------------
109
110 type Vector = (FType,FType,FType)
111
112 type In = Interval FType
113
114 ----------------------------------------------------------
115 -- Copyright
116 ----------------------------------------------------------
117
118 copyright () = "Copyright 1990,1991,1992,1993 Duncan Sinclair."
119 e_mail () = "sinclair@dcs.gla.ac.uk"
120
121 tuple = (copyright,e_mail)
122
123 ----------------------------------------------------------