I visualized bouncing balls using OpenGL. See a figure below.
I placed walls at front, back, left, right, and floor. Three balls repeatedly collide with walls and each other. Their kinetic energies are conserved(i.e. completely-elastic collision).
I implemented it in C++ with the OpenGL and boost libraries on Xcode4.3.3.
The compile option is as follows:
- Other Linker Flags: -framework OpenGL -framework GLUT
- Header Search Paths: /opt/local/include
The path /opt/local/include is for including the boost header files.
My source code is
here.
0 件のコメント:
コメントを投稿