Mini-Project: The Dancing I

October 7, 2011Posted by Se-Joon Chung

 

This is an animation of the letter 'i' implemented using Python and OpenGL. The 'i' will rotate and move around in a circle while its shape changes in a wave form.

The oscillations in the body of 'i' is created using the standing wave equation

y = 2*y0*cos(omega*t)*sin(k*x)

where y0 is the amplitude of he wave, omega is the angular frequency (2*pi*frequency), k is the wave number (2*pi/wavelength), x is the longitudinal position, and t is the time. The wavelength is the length of the segments along the horizontal or vertial rectangle depending on the region of animation. Then, triangles are rendered along those lines from positions calculated by the standing wave equation. The following wireframe model will help comprehend how the triangles are laid out.

The time variable is updated after each display loop along with the rotation angle. By calling the glTranslatef() and glRotatef() then drawing the 'i', the 'i' is rotated around the origin by the rotation angle, then translated to a circular orbit.

For further information, please look at the dancingi.py in my Miniproject folder.