-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSimulation.mli
51 lines (38 loc) · 938 Bytes
/
Simulation.mli
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
module Wall: sig
type t =
| Left
| Right
| Top
| Bottom
val repr: t -> string
end
module Ball: sig
type t = {
radius: float;
density: float;
position: float * float;
velocity: float * float;
}
val repr: t -> string
end
type t
val create: dimensions:float * float -> Ball.t list -> t
val randomize: dimensions:float * float -> balls:int -> max_speed:float -> min_radius:float -> max_radius:float -> min_density:float -> max_density:float -> t
val resize: t -> dimensions:float * float -> t
module Event: sig
type t =
| BallBallCollision of {
before: Ball.t * Ball.t;
after: Ball.t * Ball.t;
}
| WallBallCollision of {
wall: Wall.t;
before: Ball.t;
after: Ball.t;
}
val repr: t -> string
end
val dimensions: t -> float * float
val date: t -> float
val balls: t -> Ball.t list
val advance: t -> date:float -> (float * Event.t) list * t