26 static const double GRAV = 6.673e-11;
31 : id(id_key++), obj_type(0), rep(0), light(0),
32 thrust(0.0f), drag(0.0f), lat_thrust(false),
33 trans_x(0.0f), trans_y(0.0f), trans_z(0.0f), straight(false),
34 roll(0.0f), pitch(0.0f), yaw(0.0f), dr(0.0f), dp(0.0f), dy(0.0f),
35 dr_acc(0.0f), dp_acc(0.0f), dy_acc(0.0f),
36 dr_drg(0.0f), dp_drg(0.0f), dy_drg(0.0f),
37 flight_path_yaw(0.0f), flight_path_pitch(0.0f), primary_mass(0),
38 roll_rate(1.0f), pitch_rate(1.0f), yaw_rate(1.0f), shake(0.0f),
39 radius(0.0f), mass(1.0f), integrity(1.0f), life(-1), dir(0),
40 g_accel(0.0f), Do(0.0f), CL(0.0f), CD(0.0f), alpha(0.0f), stall(0.0f)
42 strcpy_s(
name,
"unknown object");
48 : id(id_key++), obj_type(t), rep(0), light(0),
49 thrust(0.0f), drag(0.0f), lat_thrust(false),
50 trans_x(0.0f), trans_y(0.0f), trans_z(0.0f), straight(false),
51 roll(0.0f), pitch(0.0f), yaw(0.0f), dr(0.0f), dp(0.0f), dy(0.0f),
52 dr_acc(0.0f), dp_acc(0.0f), dy_acc(0.0f),
53 dr_drg(0.0f), dp_drg(0.0f), dy_drg(0.0f),
54 flight_path_yaw(0.0f), flight_path_pitch(0.0f), primary_mass(0),
55 roll_rate(1.0f), pitch_rate(1.0f), yaw_rate(1.0f), shake(0.0f),
56 radius(0.0f), mass(1.0f), integrity(1.0f), life(-1), dir(0),
57 g_accel(0.0f), Do(0.0f), CL(0.0f), CD(0.0f), alpha(0.0f), stall(0.0f)
78 inline double random() {
return rand()-16384; }
219 v_2 = (v-150) * (v-150);
224 double cos_alpha = vfp1 *
cam.
vpn();
226 if (cos_alpha >= 1) {
230 alpha = (float) acos(cos_alpha);
252 double drag_eff = (
drag + (
CD * alpha_2)) * rho * v_2;
257 velocity += vn * -drag_eff * seconds;
285 double rho = 0.75 *
Do * (250e3-alt)/250e3;
332 speed *= pow(bleed, 30);
378 dr *= (float) exp(-
dr_drg * seconds);
379 dy *= (float) exp(-
dy_drg * seconds);
380 dp *= (float) exp(-
dp_drg * seconds);
382 roll = (float) (
dr * seconds);
383 pitch = (float) (
dp * seconds);
384 yaw = (float) (
dy * seconds);
391 shake *= (float) exp(-1.5 * seconds);
462 Point tmp = flight_path;
463 flight_path.
x = tmp *
cam.
vrt();
464 flight_path.
y = tmp *
cam.
vup();
465 flight_path.
z = tmp *
cam.
vpn();
467 if (flight_path.
z < 0.1)
480 flight_path.
x = tmp * yaw_cam.
vrt();
481 flight_path.
y = tmp * yaw_cam.
vup();
482 flight_path.
z = tmp * yaw_cam.
vpn();
580 else if (r < -1) r = -1;
589 else if (p < -1) p = -1;
598 else if (y < -1) y = -1;
717 double mass_delta = a.
mass - b.
mass;
745 double mass_delta = a.
mass - b.
mass;
749 Point dv = avel - bvel;
764 Point Ve_a = (bvel * (2 * b.
mass) + avel * mass_delta) * (1/mass_sum) * 0.65;
765 Point Ve_b = (avel * (2 * a.
mass) - bvel * mass_delta) * (1/mass_sum) * 0.65;
766 Point Vi_ab = (avel * a.
mass + bvel * b.
mass) * (1/mass_sum) * 0.35;