Possible wrong assertion in vtkLookupTable
I noticed an assertion in vtkLookupTable.cxx:L556 failing when it clearly shouldn't. I just updated to VTK v8.1.0.rc1, so I assume a bug is caused by one of the recent changes in the class.
Here a few numbers that demonstrate the problem:
My code generates a linear lookup table with range (0.63333264107745857, 13.439676721345073) and 255 colors. It than tries to map the maximum value. Near the line linked above, p.Shift
is -0.63333264107745857, and p.Scale
is 19.912005987166268, which makes sense based on vtkLookupShiftAndScale. So dIndex = (v + p.Shift) * p.Scale
is 255.00000000000003, and the assertion dIndex <= p.NumColors
fails.
A quick fix would be to assert only for the integer part of value, but I assume there was a specific reason not to do so.
I compiled the code on Windows in a 64bit build with the current Visual Studio 2017 version 15.4.3.