Game Development Reference
In-Depth Information
// The K1 Step:
alpha_dotdot = ComputeAlphaDotDot();
beta_dotdot = ComputeBetaDotDot();
ak1 = alpha_dotdot * dt;
bk1 = beta_dotdot * dt;
alpha_dot = at + ak1/2;
beta_dot = bt + bk1/2;
// The K2 Step:
alpha_dotdot = ComputeAlphaDotDot();
beta_dotdot = ComputeBetaDotDot();
ak2 = alpha_dotdot * dt;
bk2 = beta_dotdot * dt;
alpha_dot = at + ak2/2;
beta_dot = bt + bk2/2;
// The K3 Step:
alpha_dotdot = ComputeAlphaDotDot();
beta_dotdot = ComputeBetaDotDot();
ak3 = alpha_dotdot * dt;
bk3 = beta_dotdot * dt;
alpha_dot = at + ak3;
beta_dot = bt + bk3;
// The K3 Step:
alpha_dotdot = ComputeAlphaDotDot();
beta_dotdot = ComputeBetaDotDot();
ak4 = alpha_dotdot * dt;
bk4 = beta_dotdot * dt;
alpha_dot = at + (ak1 + 2*ak2 + 2*ak3 + ak4) / 6;
beta_dot = bt + (bk1 + 2*bk2 + 2*bk3 + bk4) / 6;
alpha = a + alpha_dot * dt;
beta = b + beta_dot * dt;
theta = gamma - alpha;
Vc2 = (R*R + L*L + 2 * R * L * cos(beta)) * ( alpha_dot * alpha_dot)
+ L*L * beta_dot * beta_dot
- 2 * (L*L + R * L * cos(beta)) * alpha_dot * beta_dot;
Vc = sqrt(Vc2);
phi = theta + beta;
fprintf(fp, "%f, %f, %f, %f, %f, %f\n", time, DEGREES(theta),
Search Nedrilad ::




Custom Search