Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- data Circle = Cir {cx,cy,cr :: Float, v :: Vector}
- deriving(Show)
- data Point = Pt {pointx, pointy :: Float}
- deriving(Show)
- data Vector = Vec {alfa,velocity::Float}
- deriving(Show)
- intersects :: Circle -> Circle -> Bool
- intersects (Cir {cx=x,cy=y,cr=r,v=Vec {alfa = deg, velocity=speed}}) (Cir {cx=a,cy=b,cr=c, v=Vec {alfa = w, velocity=vel}}) = ((x-a)*(x-a)+(y-b)*(y-b))<(r+c)*(r+c)
- megfordul :: Circle -> Circle
- megfordul (Cir {cx=x,cy=y,cr=r, v=Vec {alfa = deg, velocity=speed}}) = Cir x y r (Vec (deg+180) speed)
- degRad x = x*pi/180
- mozdul :: Circle -> Circle
- mozdul (Cir {cx=x,cy=y,cr=r, v=Vec {alfa = deg, velocity=speed}}) = Cir (x+speed*(cos (degRad deg))) (y+speed*(sin (degRad deg))) r (Vec deg speed)
- elso = Cir 0 0 1 (Vec 180 1)
- masodik = Cir 0 1 1 (Vec 90 2)
- hatv_rel f x 1 = f x
- hatv_rel f x n = f (hatv_rel f x (n-1))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement