Skip to content
Snippets Groups Projects
Commit 3e7face9 authored by Thomas Feuvrier's avatar Thomas Feuvrier
Browse files

Modif fonction MissingValue avec vnl_numeric_limit::quiet_NaN et vcl_numeric_isnan

parent db1dff55
No related branches found
No related tags found
No related merge requests found
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
#ifndef __otbEuclideanDistanceWithMissingValue_h #ifndef __otbEuclideanDistanceWithMissingValue_h
#define __otbEuclideanDistanceWithMissingValue_h #define __otbEuclideanDistanceWithMissingValue_h
#include <itkEuclideanDistance.h> #include "itkEuclideanDistance.h"
namespace otb { namespace otb {
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#define __otbEuclideanDistanceWithMissingValue_txx #define __otbEuclideanDistanceWithMissingValue_txx
#include "itkNumericTraits.h" #include "itkNumericTraits.h"
#include "vnl/vnl_math.h"
namespace otb { namespace otb {
...@@ -93,50 +94,20 @@ EuclideanDistanceWithMissingValue< TVector > ...@@ -93,50 +94,20 @@ EuclideanDistanceWithMissingValue< TVector >
return ::vcl_sqrt(temp * temp) ; return ::vcl_sqrt(temp * temp) ;
} }
#if defined(_MSC_VER) /* Microsoft Visual C++ */
#include <float.h>
template< class TVector >
/*static */
bool
EuclideanDistanceWithMissingValue< TVector >
::IsMissingValue ( const ValueType & v)
{
return static_cast<bool>( _isnan( static_cast<double>( v ) ) );
}
#elif HAVE_IEEE_COMPARISONS
template< class TVector > template< class TVector >
/*static */
bool bool
EuclideanDistanceWithMissingValue< TVector > EuclideanDistanceWithMissingValue< TVector >
::IsMissingValue ( const ValueType & v) ::IsMissingValue ( const ValueType & v)
{ {
return (v!=v); return vnl_math_isnan(v);
} }
#else
template< class TVector >
/*static */
bool
EuclideanDistanceWithMissingValue< TVector >
::IsMissingValue ( const ValueType & v)
{
return static_cast<bool>( isnan(v) );
}
#endif
template< class TVector > template< class TVector >
/* static */
void void
EuclideanDistanceWithMissingValue< TVector > EuclideanDistanceWithMissingValue< TVector >
::SetToMissingValue ( ValueType & v ) ::SetToMissingValue ( ValueType & v )
{ {
//v = static_cast<ValueType>( 0.0/0.0 ); v = vcl_numeric_limits<ValueType>::quiet_NaN();
v = std::numeric_limits<ValueType>::quiet_NaN();
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment