Game Development Reference
In-Depth Information
quantities. And they are nonlinear because they include sines and cosines of one of the
unknowns along with derivatives of the other unknown raised to some power greater
than 1.
So, how do we solve these equations? Well, we can't do so in closed form and must resort
to numerical means. There are a number of ways to proceed, but the approach we'll use
is to first solve Equation 2 for ¨ and substitute the result into Equation 1. Then, we'll
numerically integrate the result using a fourth-order Runge-Kutta scheme, as described
in Chapter 7 .
More specifically, at each time step Equation 1 with ¨ replaced by the expression derived
from Equation 1 will be solved for ¨ . Once ¨ is found, we can find ¨ using the second
equation previously solved for ¨ . Next, we can integrate ¨ and ¨ to find α and β. This
process then repeats for each time step.
Again, this is only one method of solving these equations. Normally, when faced with
a system of equations, practitioners use matrix schemes to solve the equations simul‐
taneously. This is almost necessary for systems of equations that involve more than two
equations. However, with just two equations, as we have here, we can avoid expensive
matrix inversion computation by using the technique we just described.
Solving the Golf Swing Equations
Now we'll show you how to implement the solution we described in a simple console
application. The example solves the two governing equations for α and β over time, the
results of which can then be used to determine the club head velocity at any time instant
using kinematic equations as described in Chapter 2 (see the section “Rigid-Body Kin‐
ematics” on page 61 ). Alternatively, you can use the following equation, which Dr. Jor‐
gensen gives for the club head velocity in his book:
We'll use Jorgensen's equation in this example.
Since the angles of interest are computed in units of radians, but we want to report them
in units of degrees, we first create a few define s to make the conversions for us:
#define RADIANS(d) (d/180.0*3.14159)
#define DEGREES(r) (r*180.0/3.14159)
Next, we declare and initialize all of the variables. The initial values used here are some
typical values that we assumed. You can change these values to simulate different swings:
// Variables
double alpha = 0.0;
double alpha_dot = 0.0;
double alpha_dotdot = 0.0;
double beta = RADIANS(120.0);
Search Nedrilad ::




Custom Search