SGVec3d ecPos;
SGQuatf ecOrient;
- SGVec3f myVel;
if (tInterp <= curentPkgTime) {
// Ok, we need a time prevous to the last available packet,
MotionInfo::iterator firstIt = mMotionInfo.begin();
ecPos = firstIt->second.position;
ecOrient = firstIt->second.orientation;
- myVel = firstIt->second.linearVel;
+ speed = norm(firstIt->second.linearVel) * SG_METER_TO_NM * 3600.0;
std::vector<FGFloatPropertyData>::const_iterator firstPropIt;
std::vector<FGFloatPropertyData>::const_iterator firstPropItEnd;
ecPos = ((1-tau)*prevIt->second.position + tau*nextIt->second.position);
ecOrient = interpolate((float)tau, prevIt->second.orientation,
nextIt->second.orientation);
- myVel = ((1-tau)*prevIt->second.linearVel + tau*nextIt->second.linearVel);
+ speed = norm((1-tau)*prevIt->second.linearVel
+ + tau*nextIt->second.linearVel) * SG_METER_TO_NM * 3600.0;
if (prevIt->second.properties.size()
== nextIt->second.properties.size()) {
ecOrient = motionInfo.orientation;
SGVec3f linearVel = motionInfo.linearVel;
SGVec3f angularVel = motionInfo.angularVel;
- myVel = linearVel;
while (0 < t) {
double h = 1e-1;
if (t < h)
ecOrient += h*ecOrient.derivative(angularVel);
linearVel += h*(cross(linearVel, angularVel) + motionInfo.linearAccel);
- myVel = linearVel;
angularVel += h*motionInfo.angularAccel;
t -= h;
}
+ speed = norm(linearVel) * SG_METER_TO_NM * 3600.0;
+
std::vector<FGFloatPropertyData>::const_iterator firstPropIt;
std::vector<FGFloatPropertyData>::const_iterator firstPropItEnd;
firstPropIt = it->second.properties.begin();
pos = SGGeod::fromCart(ecPos);
altitude_ft = pos.getElevationFt();
- // estimate speed (we care only about magnitude not direction/frame
- // of reference here)
- double vel_ms = sqrt( myVel[0]*myVel[0] + myVel[1]*myVel[1]
- + myVel[2]*myVel[2] );
- double vel_kts = vel_ms * SG_METER_TO_NM * 3600.0;
- speed = vel_kts;
-
// The quaternion rotating from the earth centered frame to the
// horizontal local frame
SGQuatf qEc2Hl = SGQuatf::fromLonLatRad((float)pos.getLongitudeRad(),