Functions orient the lorenz express when users cross the tracks
In my Lorenz Attractor program, I used custom functions to organize the repeated actions that control motion and behavior in the system. The sketch has many moving parts — thousands of points orbiting through space, a moving ball that can strike and scatter them, and a healing effect that pulls everything back into order.
Using functions allowed me to group related logic and call it multiple times instead of rewriting the same code everywhere. For example, the function, nextLorenzStep() , calculates how each point in the Lorenz attractor should move based on the system’s math equations. I call that function repeatedly — once for every point, every frame — to keep the attractor moving smoothly.
Working through the challenges: My challenge with Lorenz is wrapping my head around the science of it all. From a coding perspective, I need to find the best way to keep it simple. For example, the equation requires parameters Sigma, Rho and Beta. At first, with simplicity in mind, I named floats a, b, c. As the coding becomes more complex, I am able to proceed with more clarity by just naming it what it is.
Back to the science., I have to keep in mind that the Lorenz Attractor is no different from Einstein's relativity or any other commonly known equation that we learned in high school. The structure (equation) stays constant, but the conditions (the variables) shift — and that’s what creates different outcomes. So every once in a while, I have to simmer down and go back to what is constant, the equation.