1
0
Fork 0

Remove osg dependency for isNaN only.

This commit is contained in:
ThorstenB 2012-11-11 17:22:42 +01:00
parent 354a1b3a0b
commit 1d99401c04
6 changed files with 12 additions and 18 deletions

View file

@ -29,7 +29,6 @@
#include <simgear/sg_inlines.h>
#include <simgear/math/sg_geodesy.hxx>
#include <simgear/structure/exception.hxx>
#include <simgear/scene/util/OsgMath.hxx>
using std::auto_ptr;
using std::string;
@ -74,7 +73,7 @@ SGGeod SGGeodProperty::get() const
double lon = _lon->getDoubleValue(),
lat = _lat->getDoubleValue();
if (osg::isNaN(lon) || osg::isNaN(lat)) {
if (SGMisc<double>::isNaN(lon) || SGMisc<double>::isNaN(lat)) {
SG_LOG(SG_INSTR, SG_WARN, "read NaN for lon/lat:" << _lon->getPath()
<< ", " << _lat->getPath());
return SGGeod();

View file

@ -18,8 +18,6 @@
#include <vector>
#include <cstring>
#include <osg/Math>
#include <simgear/scene/model/placement.hxx>
#include <simgear/scene/model/modellib.hxx>
#include <simgear/structure/exception.hxx>
@ -150,7 +148,7 @@ namespace
{
double testNan(double val) throw (sg_range_exception)
{
if (osg::isNaN(val))
if (SGMisc<double>::isNaN(val))
throw sg_range_exception("value is nan");
return val;
}

View file

@ -35,7 +35,6 @@
#include <algorithm>
#include <cstring>
#include <errno.h>
#include <osg/Math> // isNaN
#include <simgear/misc/stdint.hxx>
#include <simgear/timing/timestamp.hxx>
@ -302,7 +301,7 @@ namespace
case props::DOUBLE:
{
float val = XDR_decode_float(*xdr);
if (osg::isNaN(val))
if (SGMisc<float>::isNaN(val))
return false;
xdr++;
break;
@ -611,8 +610,8 @@ FGMultiplayMgr::isSane(const FGExternalMotionData& motionInfo)
{
// check for corrupted data (NaNs)
bool isCorrupted = false;
isCorrupted |= ((osg::isNaN(motionInfo.time )) ||
(osg::isNaN(motionInfo.lag )) ||
isCorrupted |= ((SGMisc<double>::isNaN(motionInfo.time )) ||
(SGMisc<double>::isNaN(motionInfo.lag )) ||
(osg::isNaN(motionInfo.orientation(3) )));
for (unsigned i = 0; (i < 3)&&(!isCorrupted); ++i)
{

View file

@ -33,8 +33,6 @@
#include <boost/algorithm/string/case_conv.hpp>
#include <boost/algorithm/string/predicate.hpp>
#include <osg/Math> // for osg::isNaN
#include <simgear/timing/timestamp.hxx>
#include <simgear/debug/logstream.hxx>
#include <simgear/structure/exception.hxx>
@ -48,8 +46,8 @@ using namespace flightgear;
static void validateSGGeod(const SGGeod& geod)
{
if (osg::isNaN(geod.getLatitudeDeg()) ||
osg::isNaN(geod.getLongitudeDeg()))
if (SGMisc<double>::isNaN(geod.getLatitudeDeg()) ||
SGMisc<double>::isNaN(geod.getLongitudeDeg()))
{
throw sg_range_exception("position is invalid, NaNs");
}

View file

@ -225,7 +225,7 @@ static naRef f_getprop(naContext c, naRef me, int argc, naRef* args)
case props::DOUBLE:
{
double dv = p->getDoubleValue();
if (osg::isNaN(dv)) {
if (SGMisc<double>::isNaN(dv)) {
SG_LOG(SG_NASAL, SG_ALERT, "Nasal getprop: property " << p->getPath() << " is NaN");
return naNil();
}
@ -280,7 +280,7 @@ static naRef f_setprop(naContext c, naRef me, int argc, naRef* args)
if(naIsNil(n))
naRuntimeError(c, "setprop() value is not string or number");
if (osg::isNaN(n.num)) {
if (SGMisc<double>::isNaN(n.num)) {
naRuntimeError(c, "setprop() passed a NaN");
}

View file

@ -185,7 +185,7 @@ static naRef f_getValue(naContext c, naRef me, int argc, naRef* args)
case props::DOUBLE:
{
double dv = (*node)->getDoubleValue();
if (osg::isNaN(dv)) {
if (SGMisc<double>::isNaN(dv)) {
SG_LOG(SG_NASAL, SG_ALERT, "Nasal getValue: property " << (*node)->getPath() << " is NaN");
return naNil();
}
@ -242,7 +242,7 @@ static naRef f_setValue(naContext c, naRef me, int argc, naRef* args)
naRuntimeError(c, "props.setValue() with non-number");
double d = naNumValue(val).num;
if (osg::isNaN(d)) {
if (SGMisc<double>::isNaN(d)) {
naRuntimeError(c, "props.setValue() passed a NaN");
}
@ -282,7 +282,7 @@ static naRef f_setDoubleValue(naContext c, naRef me, int argc, naRef* args)
if (naIsNil(r))
naRuntimeError(c, "props.setDoubleValue() with non-number");
if (osg::isNaN(r.num)) {
if (SGMisc<double>::isNaN(r.num)) {
naRuntimeError(c, "props.setDoubleValue() passed a NaN");
}