The three functions declare the lut table using std::array<>, but do not assign 0 to the zeroth element of the array. I'm not a C++11 spec expert but under Visual Studio 2017 this leads to guard values /trash being assigned to lut[0]. This has a nasty effect on mask computations, as it now gets filled with INF values which ultimately leads to a division by zero exception.
The three functions declare the lut table using std::array<>, but do not assign 0 to the zeroth element of the array. I'm not a C++11 spec expert but under Visual Studio 2017 this leads to guard values/trash being assigned to lut[0]. This has a nasty effect on mask computations, as it now gets filled with INF values which ultimately leads to a division by zero exception.