I finished up imSimReal with IMSRGravity and IMSRPointObject this afternoon. I tagged it 0.1RC1 as the first release candidate for 0.1. I believe that this is complete for what I need to start work on GravityGames, my first iPhone app. It’s possible that more will be required, so I’ve left it as an RC1 and not final until GravityGames is complete.
IMSRGravity is as discussed earlier, a convenience wrapper for an NSDictionary containing the gravitational constants for various celestial bodies, such as Earth, Moon and Jupiter (included in the initial release).
IMSRPointObject represents a point mass in three dimensional space. It uses the classic kinematic equations to calculate a new position and velocity in three dimensions delta time in the future. The equations are:
r1 = r0 + v0t + 0.5at2
v1 = v0 + at
r1 is the final position (meters)
r0 is the initial position (meters)
v0 is the initial velocity (meters/second)
v1 is the final velocity (meters/second)
a is the acceleration (meters/second2)
t is the time increment (seconds)
Gravity is always negative along the Z axis.