We now define the data structure to represent the state of a ball.
type state = { pos: (float * float, float * float) event; speed: (float * float, float * float) event; radius: float; color: Graphics.color; }
It is a record whose
fields pos
, speed
, radius
and color
represent respectively the position, velocity,
radius and color of a ball.
The type of the field pos
is (float * float, float
* float) event
. That is, it is an event on which we can emit and
receive a tuple of floating numbers. It will represent the flow of
positions.