Last edited May 8, 2005 by wtbaker AaAaTtTttt uiuc d0t edu
Find this document at http://www.ncsa.uiuc.edu/Classes/MATH198/wtbaker/narrative.html
Back to Splinester Homepage

# Splinester: Details

Roller coasters for the CAVE and CUBE are not a new idea, and several different types of roller coaster programs are already running in the CAVE and CUBE today. However, my program is the first coaster program for the CAVE/CUBE that I have seen that lets users interactively design their own roller coaster, and then have the opportunity to ride the coaster that they have created. I have written the splinester program using Python and Syzygy, and its built inside of Syzygys master/slave framework. I started with PyBolt code I had written last summer as a base, and then added and removed code to create the splinester program. Two particular areas of the program warrant further discussion and those are how the splinester program creates the track, and how the program computes how to ride on the track.

Users have quite an easy time designing and creating roller coaster tracks in the splinester program, and the use of Catmull-Rom splines is one of the primary reasons that this is possible. I decided to use CR splines because of the guarantee that the track a user draws will travel through all of their control points, and because CR splines guarantee C1 continuity, so we have a guarantee that transitions between control points will be smooth. After the user draws their control points, the splinester program creates a CR spline that interpolates through all of them (including the starting and ending points, because the program creates a loop). Once the track is complete, and users are ready to ride their coaster, splinester applies a scaling factor to all of the control points, and then computes the spline again for the scaled control points. Splinester must do this scaling up so that the track will be large enough to ride.

Splinester decides how users should ride on the track by framing the spline with the Darboux-Bishop frame. Framing is the process of deciding what direction should be up, right, and forward, at every step of riding on the spline. The forward vector is simply our direction, and the Bishop frame lets us determine what directions should be up and right. Up and right are initially set in a somewhat arbitrary manner when we first start to ride the coaster (a preference is given toward having the riders of the coaster sitting upright at the start). Then, after the coaster starts to move, the Bishop frame lets us decide how to rotate our initial up and right vectors to point in new directions. The Bishop frame itself is best described as a set of rules about how we can move through space. The Bishop frames lets us pitch and yaw, but we cannot roll along our axis (unlike the Frenet frame, which lets us pitch and roll, but not yaw). Prof. McCreary explains, "One way to envision the flight of the Bishop frame is to think of it as a bullet shaped vessel flying forward along the direction of its main axis. It can only apply propulsion directly outward from its nose. Thus, its propulsion cannot increase nor can it slow down its speed. It can only change direction" (emphasis in original). We should also note that although the Bishop frame does not allow us to roll directly about our direction axis, a slow roll can be induced if we travel in a helical path (the spin will be opposite the twisting of the helical coil).

Applying the Bishop frame to our spline is rather straightforward. We keep track of our current frame in an OpenGL style 4x4 matrix, and then apply and accumulate rotations to the matrix each frame. To apply our rotations, we need to know both the axis of our rotation, and the angle that we need to rotate about that axis. To calculate the axis of rotation, we simply need to take the cross product of our old direction vector, and our new (direction vector). Then, to calculate the angle of the rotation, we just need to take the inverse sine (arcsin) of the magnitude of the cross product of the old direction vector and the new direction vector (I make sure they are unit vectors). See the figure below for more details.

After obtaining the rotation axis and angle, I let OpenGL apply the rotation to my matrix, and that completes the work that needs to be done for framing the curve.