diff options
author | Camil Staps | 2016-02-02 19:24:50 +0100 |
---|---|---|
committer | Camil Staps | 2016-02-02 19:24:50 +0100 |
commit | a7d7542dc646a5fd124ef71e71ce260889f1701b (patch) | |
tree | 04ed89503bbb3cc9933273a1326a53ca724c3492 /files/practicum/support.icl | |
parent | week6 camil: working positioning of lines by putting empties at left and righ... (diff) |
Diffstat (limited to 'files/practicum/support.icl')
-rw-r--r-- | files/practicum/support.icl | 47 |
1 files changed, 0 insertions, 47 deletions
diff --git a/files/practicum/support.icl b/files/practicum/support.icl deleted file mode 100644 index 612b00d..0000000 --- a/files/practicum/support.icl +++ /dev/null @@ -1,47 +0,0 @@ -implementation module support
-
-import StdEnv, StdIO
-
-toPoint2 :: Size Pos -> Point2
-toPoint2 {w,h} {rx,ry} = {x=toInt ((toReal w)*rx),y=toInt ((toReal h)*ry)}
-
-fromPoint2 :: Size Point2 -> Pos
-fromPoint2 {w,h} {x,y} = {rx=(toReal x)/(toReal w),ry=(toReal y)/(toReal h)}
-
-circle :: Int -> Oval
-circle r = {oval_rx=r,oval_ry=r}
-
-instance zero Pos where
- zero = {rx=zero,ry=zero}
-instance zero Vel where
- zero = {v0=zero,v1=zero}
-instance + Pos where
- (+) p1 p2 = {rx=p1.rx+p2.rx,ry=p1.ry+p2.ry}
-instance - Pos where
- (-) p1 p2 = {rx=p1.rx-p2.rx,ry=p1.ry-p2.ry}
-instance + Vel where
- (+) a b = {v0=a.v0+b.v0,v1=a.v1+b.v1}
-instance - Vel where
- (-) a b = {v0=a.v0-b.v0,v1=a.v1-b.v1}
-
-class scale a :: !Real !a -> a
-
-instance scale Pos where
- scale r p = {rx=r*p.rx,ry=r*p.ry}
-instance scale Vel where
- scale r v = {v0=r*v.v0,v1=r*v.v1}
-
-class toVel a :: !a -> Vel
-
-instance toVel Pos where
- toVel p = {v0=p.rx,v1=p.ry}
-
-class dist a :: !a !a -> Real
-
-instance dist Pos where
- dist p1 p2 = sqrt ((p1.rx - p2.rx)^2.0 + (p1.ry - p2.ry)^2.0)
-instance dist Real where
- dist r1 r2 = abs (r1 - r2)
-
-movePos :: Vel Pos -> Pos
-movePos v p = {p & rx=p.rx+v.v0,ry=p.ry+v.v1}
|