Saturday, June 7, 2008

Quelling the Ribbon

The simulation has a variable called currTime, which is incremented by the TimeStep each iteration through the simulation main loop. The value of currTime is initialized to -3600 * 0, which evaluates to zero.

There are places in the simulation where the code checks to see if the value of currTime is greater than zero, including the determination on whether the a ribbon segment breaks.

I thought about the initialization value of currTime, and realized that its purpose is to allow the programmer to change that zero to a one, which would allow a quick way to change between two specific values for the start of the simulation, -3600 or zero.

I changed the start value of currTime to -3600 * 1, and did not see any ribbon breaks. I was elated for a minute, until I realized that if currTime was set to -3600, that the number of time steps (numTimeSteps) that the simulation was running, times the TimeStep would never allow currTime to be a positive number. I fixed that problem, and now have the simulation running for sixteen hundred iterations past the zero point without any ribbon breaks. I did this without including any artificial dampening on the ribbon when time is less than zero (which I may want to add).

Because of the way the ribbon is initialized in the simulation, there is a period of time that needs to pass once forces are applied to the ribbon for it to settle down before it can be played with. In the real world, this won't be a problems, since no one is planning to put the ribbon in place, and then magically switch on gravity, centripetal acceleration, and Coriolis.

I should be able to apply more of the equations from the pointDynamics and ribbonDynamics to create a better approximation of the stable ribbon in the initRibbon method. I can also determine how long it takes for the ribbon to stabilize once forces are applied.

No comments: