MSVC fixes
This commit is contained in:
parent
7ec7a8b60c
commit
709936a265
2 changed files with 18 additions and 18 deletions
|
@ -97,7 +97,7 @@ FGAISim::init() {
|
||||||
UVW_body[U] = fgGetFloat("sim/presets/uBody-fps");
|
UVW_body[U] = fgGetFloat("sim/presets/uBody-fps");
|
||||||
UVW_body[V] = fgGetFloat("sim/presets/vBody-fps");
|
UVW_body[V] = fgGetFloat("sim/presets/vBody-fps");
|
||||||
UVW_body[W] = fgGetFloat("sim/presets/wBody-fps");
|
UVW_body[W] = fgGetFloat("sim/presets/wBody-fps");
|
||||||
set_velocity_fps( simd4::magnitude(UVW_body) );
|
set_velocity_fps( UVW_body[U] );
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -120,17 +120,17 @@ FGAISim::update(double ddt)
|
||||||
|
|
||||||
// Earth-to-Body-Axis Transformation Matrix
|
// Earth-to-Body-Axis Transformation Matrix
|
||||||
// body = pitch, roll, yaw
|
// body = pitch, roll, yaw
|
||||||
simd4_t<float,3> angles = euler;
|
simd4_t<float,4> angles = euler;
|
||||||
float angle = simd4::normalize(angles);
|
float angle = simd4::normalize(angles);
|
||||||
simd4x4_t<float,4> EBM = simd4x4::rotation_matrix<float>(angle, angles);
|
simd4x4_t<float,4> EBM = simd4x4::rotation_matrix<float>(angle, angles);
|
||||||
|
|
||||||
// Body-Axis Gravity Components
|
// Body-Axis Gravity Components
|
||||||
simd4_t<float,4> gb = EBM*simd4_t<float,4>(gravity);
|
simd4_t<float,4> gb = EBM*gravity;
|
||||||
simd4_t<float,4> windb = EBM*simd4_t<float,4>(wind_ned);
|
simd4_t<float,4> windb = EBM*wind_ned;
|
||||||
|
|
||||||
// Air-Relative velocity vector
|
// Air-Relative velocity vector
|
||||||
simd4_t<float,3> Va = UVW_body + simd4_t<float,3>(windb);
|
simd4_t<float,3> Va = UVW_body + windb;
|
||||||
update_UVW_body(simd4::magnitude(Va));
|
set_velocity_fps(Va[U]);
|
||||||
if (std::abs(velocity) > 1.0f) {
|
if (std::abs(velocity) > 1.0f) {
|
||||||
set_alpha_rad( std::atan(Va[3]/std::abs(Va[1])) );
|
set_alpha_rad( std::atan(Va[3]/std::abs(Va[1])) );
|
||||||
set_beta_rad( std::asin(Va[2]/velocity) );
|
set_beta_rad( std::asin(Va[2]/velocity) );
|
||||||
|
@ -178,15 +178,15 @@ FGAISim::update(double ddt)
|
||||||
FXYZ += FThrust;
|
FXYZ += FThrust;
|
||||||
// MlmnT += MThrust;
|
// MlmnT += MThrust;
|
||||||
|
|
||||||
// Gear forces - http://tutorial.math.lamar.edu/Classes/DE/Vibrations.aspx
|
// Gear forces
|
||||||
if (0) { // WoW
|
float gear_comp = 0.2f + _MINMAX(agl/gear[Z], -0.2f, 0.0f);
|
||||||
simd4_t<float,3> FLMLG = 0.0f, FRLMG = 0.0f, FNLG = 0.0f;
|
printf("agl: %7.6f, gear-z: %7.6f, comp: %f\n", agl, gear[Z], gear_comp);
|
||||||
float gear_comp = 1.0f + _MINMAX(agl/gear[Z], -1.0f, 0.0f);
|
if (gear_comp > 0.1f) {
|
||||||
FNLG[Z] = FLMLG[Z] = FRLMG[Z] = Cgear*gear_comp;
|
simd4_t<float,3> FLGear = 0.0f; FLGear[Z] = Cgear*gear_comp;
|
||||||
simd4_t<float,3> FLGear = 0.0f, MLGear = 0.0f;
|
// simd4_t<float,3> MLGear = 0.0f;
|
||||||
|
|
||||||
FXYZ += FLGear;
|
FXYZ += FLGear;
|
||||||
MlmnT += MLGear;
|
// MlmnT += MLGear;
|
||||||
}
|
}
|
||||||
FXYZ /= m;
|
FXYZ /= m;
|
||||||
|
|
||||||
|
@ -205,7 +205,7 @@ printf("UVW: %5.4f, %5.4f, %5.4f\n", dUVW[U], dUVW[V], dUVW[W]);
|
||||||
|
|
||||||
/* position of center of mass wrt earth: north, east, down */
|
/* position of center of mass wrt earth: north, east, down */
|
||||||
simd4_t<float,4> dNED_cm;
|
simd4_t<float,4> dNED_cm;
|
||||||
dNED_cm = simd4x4::transpose(EBM)*simd4_t<float,4>(UVW_body);
|
dNED_cm = simd4x4::transpose(EBM)*UVW_body;
|
||||||
|
|
||||||
double az2, dist = simd4::magnitude(dNED_cm);
|
double az2, dist = simd4::magnitude(dNED_cm);
|
||||||
SGGeod pos2, pos = getPosition();
|
SGGeod pos2, pos = getPosition();
|
||||||
|
|
|
@ -160,14 +160,14 @@ private:
|
||||||
float br; /* brake */
|
float br; /* brake */
|
||||||
|
|
||||||
/* aircraft state */
|
/* aircraft state */
|
||||||
simd4_t<float,3> NED_cm; /* lat, lon, altitude */
|
simd4_t<float,4> NED_cm; /* lat, lon, altitude */
|
||||||
simd4_t<float,3> UVW_body; /* fwd, up, side speed */
|
simd4_t<float,4> UVW_body; /* fwd, up, side speed */
|
||||||
simd4_t<float,3> PQR_body; /* P, Q, R rate */
|
simd4_t<float,3> PQR_body; /* P, Q, R rate */
|
||||||
simd4_t<float,3> PQR_dot; /* Pdot, Qdot, Rdot accel. */
|
simd4_t<float,3> PQR_dot; /* Pdot, Qdot, Rdot accel. */
|
||||||
simd4_t<float,3> ABY_body; /* alpha, beta, gamma */
|
simd4_t<float,3> ABY_body; /* alpha, beta, gamma */
|
||||||
simd4_t<float,3> ABY_dot; /* adot, bdot, ydot */
|
simd4_t<float,3> ABY_dot; /* adot, bdot, ydot */
|
||||||
simd4_t<float,3> euler; /* phi, theta, psi */
|
simd4_t<float,3> euler; /* phi, theta, psi */
|
||||||
simd4_t<float,3> wind_ned;
|
simd4_t<float,4> wind_ned;
|
||||||
float agl, velocity;
|
float agl, velocity;
|
||||||
|
|
||||||
/* history, these change between every call to update() */
|
/* history, these change between every call to update() */
|
||||||
|
@ -209,7 +209,7 @@ private:
|
||||||
|
|
||||||
/* static environment data */
|
/* static environment data */
|
||||||
static float env[101][2];
|
static float env[101][2];
|
||||||
simd4_t<float,3> gravity;
|
simd4_t<float,4> gravity;
|
||||||
float dt2_2m;
|
float dt2_2m;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue