This a new version of my elasto dynamics demo that has not run for several versions of Mac OS.
It uses OpenGL and is compliant, I think, with Apple’s current API.
The previous version drilled down thru leaky abstractions to access the raw pixels.
That is now harder and less necessary.
Still OpenGL calls are hard to debug.
This is a zipped Mac application for either processor that should work at least on Mac OS 10.3 and later.
Here is an Xcode (3.0) project with the sources.
(As of 2010 Nov 8, Xcode 3.2.3, OS X 10.6.4, it still works.
On 2011 Sept 1, OS X 10.7.1, Xcode 4.1 ditto)
On 2010 Aug 19 I:
- Download the zipped Xcode file;
- In Finder, double click on the downloaded file icon;
(This will create a folder called Bounce in the same folder.)
- Say “cd /Xcode4/Applications” in terminal ap. (I have Xcode 4 beta (4A119a).)
- Say “open Xcode.app” in terminal ap,
- Click on “open” button in Xcode,
- Navigate to Bounce folder and select file bounce.xcodeproj therein,
- Type splat(⌘) R.
On 2012 May 20 I:
- Download the zipped Xcode file;
- In Finder, double click on the downloaded file icon;
(This will create a folder called Bounce in the same folder.)
- Launch Xcode.app (in your normal applications folder if you have installed Xcode 4.3.x)
- Menu > File > Open… (navigate to Bounce/bouncexcodeproj and open)
- Click the upper left “Run” button.
- Wait briefly for it to compile.
- Ignore (for now) yellow errors.
You should now be running the program.
There are several mouse and keyboard controls.
The mouse controls the view of the scene.
“Button down” − “move mouse left” − “Button up” rotates the action to the left, or moves the viewer to the right.
Moving the mouse up, down or to the right are similar.
Near the edges of the frame the mouse rotates the image about an axis out of the frame.
With the option key the mouse moves the scene.
Mouse up and down with the ctrl key moves the scene closer and farther from the viewer.
None of these affect the physics, only the view of the physics.
The following key commands interact with the physics.
Note that upper case letters commence some feature while the corresponding lower case letter stops it.
- r
- This stops time which is useful to study a snapshot in time.
The image can be examined from all sides while time stands still.
The program starts with time stopped.
- R
- Restart time.
- V
- Compress vice some.
Initially nothing is happening and this starts the action.
The vice velocity decays.
Each ‘V’ shrinks the bar by about one zone’s length.
- v
- Opposite of ‘V’. Stretches rod by same amount.
Note display of “vice displacement”.
- f
- Release (free) vice. This cannot be undone.
- D
- Dampen. This imposes a viscosity.
Velocity is taxed.
- d
- Viscosity is removed—the initial state.
- S
- Double delta t.
This speeds up the graphics but only because the system is compute bound.
More significantly it increases the truncation error of the numerical integration.
- s
- Halve delta t. Note dt is reported at lower left.
Before you start the vice you should rotate the image for a good view.
Start time by ‘R’.
Type 4 or 5 V’s and watch.
Free the ends sometime (f).
Note that there are no disapative forces until you do D.
It will writhe until you dampen it.
You can drive it unstable with too large a dt or compressing it too much.