SoccerFun-0.1.1: Football simulation framework for teaching functional programming

SoccerFun.Geometry

Synopsis

# Documentation

data Position Source

Constructors

 Position Fieldspx :: XPosx-coordinate in plane (0.0<=px) py :: YPosy-coordinate in plane (0.0<=py)

data Position3D Source

Constructors

 Position3D Fieldspxy :: Position pz :: ZPos

type AngleSource

Arguments

 = Radian angle in radians, clockwise

`movePoint v p` moves point p over vector v.

`pointToRectangle (a,b) c` returns c if (pointInRectangle (a,b) c) and the | projected point c' of c that is exactly on the closest edge of rectangle | (a,b).

`pointInRectangle (a,b) c` | returns True iff point c is inside the rectangle determined by | the diagonal corner points a and b.

data RVector Source

Constructors

 RVector Fieldsdx :: Metredifference in x-coordinate (|dx| <= 1.0) dy :: Metredifference in y-coordinate (|dy| <= 1.0)

Instances

 Eq RVector Num RVector Show RVector

data RVector3D Source

Constructors

 RVector3D Fieldsdxy :: RVector dz :: Metre

Instances

 Eq RVector3D Num RVector3D Show RVector3D

data Speed Source

speed of an object

Constructors

 Speed Fieldsdirection :: Angledirection of object velocity :: Velocityvelocity of object

Instances

 Eq Speed Num Speed Show Speed ToSpeed3D Speed Mirror Speed

data Speed3D Source

speed of an object in space

Constructors

 Speed3D Fieldsvxy :: Speedsurface speed of object vz :: Velocityvelocity in z-axis (positive: goes up; negative: goes down; zero: horizontally)

Instances

 Eq Speed3D Num Speed3D Show Speed3D

type VelocitySource

Arguments

 = Float velocity in metre/second

class ToSpeed a whereSource

Methods

toSpeed :: a -> SpeedSource

class FromSpeed a whereSource

Methods

fromSpeed :: Speed -> aSource

class ToSpeed3D a whereSource

Methods

toSpeed3D :: a -> Speed3DSource

Instances

 ToSpeed3D Speed

class FromSpeed3D a whereSource

Methods

fromSpeed3D :: Speed3D -> aSource

class ToRVector a whereSource

Methods

toRVector :: a -> RVectorSource

Instances

 ToRVector Float interpret Float as angle in radians ToRVector Position

class ToPosition a whereSource

Methods

toPosition :: a -> PositionSource

class FromPosition a whereSource

Methods

class ToPosition3D a whereSource

Instances

 ToPosition3D Position

class FromPosition3D a whereSource

Methods

type Degrees = IntSource

Conversion of radians to degrees and vice versa:

`scaleVector k {dx,dy}` returns {k*dx,k*dy} | `scaleVector3D k {dxy,dz}` returns `{scaleVector k dxy,k*dz}`

`betweenPoints (a,b) c` returns True iff c is on the line between a and b.

`sizeVector {dx,dy} = sqrt (dx**2 + dy**2)` | `sizeVector3D {dxy,dz} = sqrt ((dx dxy)**2 + (dy dxy)**2 + dz**2)`

class Dist a b whereSource

Methods

dist :: a -> b -> FloatSource

orthogonal :: Angle -> (Angle, Angle)Source

`orthogonal a` returns the left- and right- orthogonal angles to a

gets the angle between two objects | positive angle is CW, negative is CCW