Vector::Vector(double angle, Speed R){ setAngleRad((float)angle); // qDebug("angle: %f", angle*180/PI); _speed=R.getMps(); // qDebug("_speed: %f", _speed); dirtyDR=false; dirtyXY=true; }
/** * This function formats the variometer speed value in meters with sign +/-, * 3 numbers with 3 decimal numbers. */ QString IgcLogger::formatVario(const Speed vSpeed) { QString result; double mps = vSpeed.getMps(); if( mps == 0.0 ) { result += " "; } else if( mps > 0.0 ) { result += "+"; } // We need a number with 6 digits and without a decimal point. Therefore // the value meter per second is multiplied with 1000. result += QString("%1").arg( (int) rint(mps*1000.0), 6, 10, QChar('0') ); return result; }
/** Sets the Y (latitudinal) speed in meters per second. */ void Vector::setY(Speed y){ if (dirtyXY) recalcXY(); _y=y.getMps(); dirtyDR=true; }
/** Sets the X (longitudinal) speed in meters per second. */ void Vector::setX(Speed x){ if (dirtyXY) recalcXY(); _x=x.getMps(); dirtyDR=true; }
/** * operator for speed. */ Speed operator *(double left, const Speed& right) { return Speed(left * right.getMps()); }