Precept 6: On assignment 3
Start early on this assignment. Even though you're doing this assignment
in teams of two, it's still fairly large.
Some stuff mentioned during precept:
- instead of writing a function which "draws a circle with a specific
center and a specific radius", you may want to write a function
which "draws a unit circle at the origin transformed by some
matrix". This approach is more general, and will help you in
the remainder of the assignment
- you're free to use an existing matrix/vector library, as long as
you mention in your README where you got it from
- don't overdo it on the user I/O: there should just be a mechanism
to put "shapes of generation 1" on the screen, with a certain
velocity and direction. Also it should be possible to resize the
window, i.e. to make the area the shapes bounce in larger
(or smaller)
- a generation change after a collision may be up or down, but make
it so that the trend is upwards. You can add a feature where a
shape disappears when it reaches a certain generation. Feel free
to implement your own additional rules here
- The formulas for (v` is the speed after a collision):
- conservation of momentum:
m_1 * v_1 + m_2 * v_2 = m_1 * v'_1 + m_2 * v'_2
- conservation of kinetic energy:
0.5 * m_1 * v_1^2 + 0.5 * m_2 * v_2^2 =
0.5 * m_1 * v'_1^2 + 0.5 * m_2 * v'_2^2
It is easiest to use the formulas separately for the x- and
y-direction. As has been said, if you want to keep it simple,
you can assume all masses are the same, so all the "m's" cancel
out in the above formulas
Patrick Min, CS Department, Princeton University
Last modified: Tue Oct 22 22:59:24 1996