Fix instances of error: isnan was not declared in this scope with GCC5.3/Ubuntu 16.04

In all but these 3 files isnan is glm::isnan
This commit is contained in:
Omega Hereon [J.L.] 2016-04-18 18:38:52 +00:00
parent 8db8d1e31d
commit b3b58b8176
3 changed files with 6 additions and 6 deletions

View file

@ -388,7 +388,7 @@ void SwingTwistConstraint::dynamicallyAdjustLimits(const glm::quat& rotation) {
glm::vec3 swungY = swingRotation * Vectors::UNIT_Y;
glm::vec3 swingAxis = glm::cross(Vectors::UNIT_Y, swungY);
float theta = atan2f(-swingAxis.z, swingAxis.x);
if (isnan(theta)) {
if (glm::isnan(theta)) {
// atan2f() will only return NaN if either of its arguments is NaN, which can only
// happen if we've been given a bad rotation. Since a NaN value here could potentially
// cause a crash (we use the value of theta to compute indices into a std::vector)

View file

@ -34,7 +34,7 @@ float PIDController::update(float measuredValue, float dt, bool resetAccumulator
if (getIsLogging()) { // if logging/reporting
updateHistory(measuredValue, dt, error, accumulatedError, changeInError, p, i, d, computedValue);
}
Q_ASSERT(!isnan(computedValue));
Q_ASSERT(!glm::isnan(computedValue));
// update state for next time
_lastError = error;
@ -75,4 +75,4 @@ void PIDController::reportHistory() {
qCDebug(shared) << "Limits: setpoint" << getMeasuredValueSetpoint() << "accumulate" << getAccumulatedValueLowLimit() << getAccumulatedValueHighLimit() <<
"controlled" << getControlledValueLowLimit() << getControlledValueHighLimit() <<
"kp/ki/kd" << getKP() << getKI() << getKD();
}
}

View file

@ -18,7 +18,7 @@ void Settings::getFloatValueIfValid(const QString& name, float& floatValue) {
const QVariant badDefaultValue = NAN;
bool ok = true;
float tempFloat = value(name, badDefaultValue).toFloat(&ok);
if (ok && !isnan(tempFloat)) {
if (ok && !glm::isnan(tempFloat)) {
floatValue = tempFloat;
}
}
@ -47,7 +47,7 @@ void Settings::getVec3ValueIfValid(const QString& name, glm::vec3& vecValue) {
float x = value(QString("x"), badDefaultValue).toFloat(&ok);
float y = value(QString("y"), badDefaultValue).toFloat(&ok);
float z = value(QString("z"), badDefaultValue).toFloat(&ok);
if (ok && (!isnan(x) && !isnan(y) && !isnan(z))) {
if (ok && (!glm::isnan(x) && !glm::isnan(y) && !glm::isnan(z))) {
vecValue = glm::vec3(x, y, z);
}
}
@ -74,7 +74,7 @@ void Settings::getQuatValueIfValid(const QString& name, glm::quat& quatValue) {
float y = value(QString("y"), badDefaultValue).toFloat(&ok);
float z = value(QString("z"), badDefaultValue).toFloat(&ok);
float w = value(QString("w"), badDefaultValue).toFloat(&ok);
if (ok && (!isnan(x) && !isnan(y) && !isnan(z) && !isnan(w))) {
if (ok && (!glm::isnan(x) && !glm::isnan(y) && !glm::isnan(z) && !glm::isnan(w))) {
quatValue = glm::quat(w, x, y, z);
}
}