Billiard on Qt

So... In honor of Cosmonautics Day and coincidentally the faculty day at our university, I had a great chance to win some money and participate in a contest of physical modelers... One of the tasks was to write a billiard game on Qt (well, I've embellished it with Qt =) Here's what I came up with.

I won't delve into the mathematical and physical model with formulas, I'm not in the mood for that, I'll just highlight the key points:

  1. All cue ball hits are central, ball-to-ball - as it happens, more realistically.
  2. Friction against the table is introduced.
  3. Energy is also lost in the interactions between balls and ball/wall.
  4. The "queue" principle is used (i.e., trajectories are pre-calculated before collisions).
  5. Control is done using the mouse - hold down the left button and strike.
  6. The strike speed depends on the speed of mouse movement.
  7. Post-collision velocities are calculated according to the laws of conservation.
  8. A score is kept (very primitive, I was in a rush after all =)).

Please don't judge too harshly, the focus was on physics, not beauty, the writing time was limited; the physics engine is somewhat realistic (excluding non-central cue strikes), the graphics are done with qwtplot.

If anyone wants to rewrite/use something - I would be delighted) I would also appreciate it if you let me know about it.

Here's what it looks like:

Qt project: billiard (qwt is configured for linux)