Merge pull request #400 from willismonroe/patch-2

use std::isnan
This commit is contained in:
YVT 2016-07-14 14:53:40 +09:00 committed by GitHub
commit 3862627bbd

View File

@ -189,14 +189,14 @@ namespace spades {
}
static float MyACos(float v){
SPAssert(!isnan(v));
SPAssert(!std::isnan(v));
if(v >= 1.f) return 0.f;
if(v <= -1.f) return static_cast<float>(M_PI);
float vv = acosf(v);
if(isnan(vv)){
if(std::isnan(vv)){
vv = acosf(v * .9999f);
}
SPAssert(!isnan(vv));
SPAssert(!std::isnan(vv));
return vv;
}
@ -237,7 +237,7 @@ namespace spades {
strength = MyACos(dot) - MyACos(minDot);
}
SPAssert(!isnan(strength));
SPAssert(!std::isnan(strength));
strength *= 20.f;
strength *= dt;
@ -298,7 +298,7 @@ namespace spades {
strength = MyACos(dot) - MyACos(minDot);
}
SPAssert(!isnan(strength));
SPAssert(!std::isnan(strength));
strength *= 100.f;
strength *= dt;
@ -629,9 +629,9 @@ namespace spades {
Vector3 oldPos = node.lastPos;
node.pos += node.vel * dt;
SPAssert(!isnan(node.pos.x));
SPAssert(!isnan(node.pos.y));
SPAssert(!isnan(node.pos.z));
SPAssert(!std::isnan(node.pos.x));
SPAssert(!std::isnan(node.pos.y));
SPAssert(!std::isnan(node.pos.z));
if(node.pos.z > 63.f){
node.vel.z -= dt * 6.f; // buoyancy