diff --git a/Common/Core/Testing/Cxx/TestLookupTable.cxx b/Common/Core/Testing/Cxx/TestLookupTable.cxx index f9a05d5ed0f083196408a6e8fd3f32653c5bc23a..0232fdcf44ac5ea24ded6000657de4ee9b8dbaf2 100644 --- a/Common/Core/Testing/Cxx/TestLookupTable.cxx +++ b/Common/Core/Testing/Cxx/TestLookupTable.cxx @@ -166,6 +166,7 @@ int TestLookupTable(int,char *[]) TestAssert(table->GetIndex(hi) == 255); TestAssert(table->GetIndex(lo+tol) == 0); TestAssert(table->GetIndex(hi-tol) == 255); + TestAssert(table->GetIndex(vtkMath::Nan()) == -1); // Note - both below- and above-range colors are enabled at this point TestAssert(table->GetIndex(lo/step) == 0); diff --git a/Common/Core/vtkLookupTable.cxx b/Common/Core/vtkLookupTable.cxx index 9d10ddbef15f5db78a550b607dc27e1a1f8cce1f..ffcb25d884c0128481e3ba12c735cf63b07fb2fa 100644 --- a/Common/Core/vtkLookupTable.cxx +++ b/Common/Core/vtkLookupTable.cxx @@ -415,8 +415,8 @@ inline void vtkLookupTableLogRange(const double range[2], double logRange[2]) //---------------------------------------------------------------------------- // Apply log to value, with appropriate constraints. -inline double vtkApplyLogScale(double v, const double range[2], - const double logRange[2]) +static double vtkApplyLogScaleMain(double v, const double range[2], + const double logRange[2]) { // is the range set for negative numbers? if (range[0] < 0) @@ -452,6 +452,40 @@ inline double vtkApplyLogScale(double v, const double range[2], return v; } +//---------------------------------------------------------------------------- +template<class T> +double vtkApplyLogScale(T v, const double range[2], + const double logRange[2]) +{ + return vtkApplyLogScaleMain(v, range, logRange); +} + +//---------------------------------------------------------------------------- +// Apply log to a float value (NaN values pass through) +inline double vtkApplyLogScale(float v, const double range[2], + const double logRange[2]) +{ + if (vtkMath::IsNan(v)) + { + return v; + } + + return vtkApplyLogScaleMain(v, range, logRange); +} + +//---------------------------------------------------------------------------- +// Apply log to a double value (NaN values pass through) +inline double vtkApplyLogScale(double v, const double range[2], + const double logRange[2]) +{ + if (vtkMath::IsNan(v)) + { + return v; + } + + return vtkApplyLogScaleMain(v, range, logRange); +} + //---------------------------------------------------------------------------- // Data structure for passing data around various internal functions struct TableParameters { diff --git a/IO/NetCDF/Testing/Data/Baseline/SLACParticleReader.png.md5 b/IO/NetCDF/Testing/Data/Baseline/SLACParticleReader.png.md5 index ac2ae393cbb74cf2d2dcbc1c110162ec74748da3..67af9d8f601c77734104b30edb7cfb7fad368923 100644 --- a/IO/NetCDF/Testing/Data/Baseline/SLACParticleReader.png.md5 +++ b/IO/NetCDF/Testing/Data/Baseline/SLACParticleReader.png.md5 @@ -1 +1 @@ -4fabbc42a15ea77fd8bfa7a0c4546b05 +99e7c509f50c6593cdbb3727621a38d9