SoccerFun-0.4: 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

`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 Binary Speed FromSpeed3D 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; 0: horizontally)

Instances

 Eq Speed3D Num Speed3D Show Speed3D Binary Speed3D FromSpeed Speed3D ToSpeed Speed3D

type VelocitySource

Arguments

 = Float velocity in metre/second

class ToSpeed a whereSource

Methods

toSpeed :: a -> SpeedSource

Instances

 ToSpeed Speed3D

class FromSpeed a whereSource

Methods

fromSpeed :: Speed -> aSource

Instances

 FromSpeed Speed3D

class ToSpeed3D a whereSource

Methods

toSpeed3D :: a -> Speed3DSource

Instances

 ToSpeed3D Speed

class FromSpeed3D a whereSource

Methods

fromSpeed3D :: Speed3D -> aSource

Instances

 FromSpeed3D Speed

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

Instances

 ToPosition Position3D ToPosition (Float, Float)

class FromPosition a whereSource

Methods

Instances

 FromPosition Position3D FromPosition (Float, Float)

class ToPosition3D a whereSource

Instances

 ToPosition3D Position ToPosition3D (Float, Float, Float)

class FromPosition3D a whereSource

Methods

Instances

 FromPosition3D Position FromPosition3D (Float, Float, Float)

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