SoccerFun-0.3: Football simulation framework for teaching functional programming

SoccerFun.Geometry

Synopsis

Documentation

data Position Source

Constructors

Position 

Fields

px :: XPos

x-coordinate in plane (0.0<=px)

py :: YPos

y-coordinate in plane (0.0<=py)

type AngleSource

Arguments

 = Radian

angle in radians, clockwise

movePoint :: RVector -> Position -> PositionSource

movePoint v p moves point p over vector v.

pointToRectangle :: (Position, Position) -> Position -> PositionSource

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 :: (Position, Position) -> Position -> BoolSource

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 

Fields

dx :: Metre

difference in x-coordinate |dx| <= 1.0

dy :: Metre

difference in y-coordinate |dy| <= 1.0

data RVector3D Source

Constructors

RVector3D 

Fields

dxy :: RVector
 
dz :: Metre
 

data Speed Source

speed of an object

Constructors

Speed 

Fields

direction :: Angle

direction of object

velocity :: Velocity

velocity of object

data Speed3D Source

speed of an object in space

Constructors

Speed3D 

Fields

vxy :: Speed

surface speed of object

vz :: Velocity

velocity in z-axis (positive: goes up; negative: goes down; 0: horizontally)

type VelocitySource

Arguments

 = Float

velocity in metre/second

class ToSpeed a whereSource

Methods

toSpeed :: a -> SpeedSource

Instances

class FromSpeed a whereSource

Methods

fromSpeed :: Speed -> aSource

Instances

class ToSpeed3D a whereSource

Methods

toSpeed3D :: a -> Speed3DSource

Instances

class FromSpeed3D a whereSource

Methods

fromSpeed3D :: Speed3D -> aSource

Instances

class ToRVector a whereSource

Methods

toRVector :: a -> RVectorSource

Instances

ToRVector Float

interpret Float as angle in radians

ToRVector Position 

type Degrees = IntSource

Conversion of radians to degrees and vice versa:

scaleVector :: Float -> RVector -> RVectorSource

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

betweenPoints :: (Position, Position) -> Position -> BoolSource

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

sizeVector :: RVector -> FloatSource

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

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

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

angleWithObjectForRun :: (Position, Angle) -> Position -> AngleSource

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