Introduction
This software considers bending forces to model a discrete elastic rod visualized in OpenGL. To implement the constraint that edge lengths remain constant, a stretching force is also implemented.
User Interface
This lab uses GLUT, which means the user interface is not nearly as intuitive or powerful as the Cocoa apps.

Mouse interaction:
Click and drag the left mouse button to rotate around the origin. Click and drag the right mouse button to translate the object. Clicking and dragging the right mouse button while holding down shift translates on a different axis. These controls are rather unintuitive and will be improved when I get the chance.

Key interaction:
Press 'c' to toggle recording to ppm files named frame#.ppm in the working directory.
Press 'r' to reset the vertices to their input-file-specified locations.
Press 'f' to toggle display of the bending force unit vectors.
Press 'q' to get out when you become bored.
Input File Format and Examples
The input files consist of a list of quadruplets, one per line, that describe each vertex: x, y, z, and then a boolean value indicating wither the vertex is fixed or not (1 means fixed, 0 means unfixed). Here are two example input files and the resultant behavior demonstrated by animated GIFs. Note the images were flipped Vertically in the output process.
sine_fixed.txt: 0 0 0 1 1 1.5 1 0 1.5 1 1.5 0 2 2 2 1

sine.txt: 0 0 0 0 1 1.5 1 0 1.5 1 1.5 0 2 2 2 1
Obtaining
This program is written in C++ using GLUT. It should compile on most Linux, Windows, and Mac OS X machines if the proper libraries are installed. You should be able to run the program by running:
> 'make' > ./elasticRods window_width window_height input_filename
As usual, please be aware that this is by no means polished software, as it was written for a weekly assignment.
Design and code ©2012 Julian Panetta
Valid HTML 4.01 Strict