Browse Source

std::fmod casting

std::fmod returned inconsistently with its input types, so now it's cast to the correct type regardless.

Former-commit-id: 48f9fe14f1e16fffdbcbfb0cc9cfb7f086613e84
Joe Graus 7 years ago
parent
commit
984c8eb25b
4 changed files with 4 additions and 4 deletions
  1. 1 1
      include/igl/inferno.cpp
  2. 1 1
      include/igl/magma.cpp
  3. 1 1
      include/igl/plasma.cpp
  4. 1 1
      include/igl/viridis.cpp

+ 1 - 1
include/igl/inferno.cpp

@@ -292,7 +292,7 @@ IGL_INLINE void igl::inferno(const T x_in, T & r, T & g, T & b)
 	T _g[2] = { inferno_cm[least][1], inferno_cm[most][1] };
 	T _b[2] = { inferno_cm[least][2], inferno_cm[most][2] };
 
-	T t = std::max(zero, std::min(one, fmod(x_in_clamped * static_cast<T>(pal), one)));
+	T t = std::max(zero, std::min(one, static_cast<T>(fmod(x_in_clamped * static_cast<T>(pal), one))));
 
 	r = std::max(zero, std::min(one, (one - t) * _r[0] + t * _r[1]));
 	g = std::max(zero, std::min(one, (one - t) * _g[0] + t * _g[1]));

+ 1 - 1
include/igl/magma.cpp

@@ -292,7 +292,7 @@ IGL_INLINE void igl::magma(const T x_in, T & r, T & g, T & b)
 	T _g[2] = { magma_cm[least][1], magma_cm[most][1] };
 	T _b[2] = { magma_cm[least][2], magma_cm[most][2] };
 
-	T t = std::max(zero, std::min(one, fmod(x_in_clamped * static_cast<T>(pal), one)));
+	T t = std::max(zero, std::min(one, static_cast<T>(fmod(x_in_clamped * static_cast<T>(pal), one))));
 
 	r = std::max(zero, std::min(one, (one - t) * _r[0] + t * _r[1]));
 	g = std::max(zero, std::min(one, (one - t) * _g[0] + t * _g[1]));

+ 1 - 1
include/igl/plasma.cpp

@@ -292,7 +292,7 @@ IGL_INLINE void igl::plasma(const T x_in, T & r, T & g, T & b)
 	T _g[2] = { plasma_cm[least][1], plasma_cm[most][1] };
 	T _b[2] = { plasma_cm[least][2], plasma_cm[most][2] };
 
-	T t = std::max(zero, std::min(one, fmod(x_in_clamped * static_cast<T>(pal), one)));
+	T t = std::max(zero, std::min(one, static_cast<T>(fmod(x_in_clamped * static_cast<T>(pal), one))));
 
 	r = std::max(zero, std::min(one, (one - t) * _r[0] + t * _r[1]));
 	g = std::max(zero, std::min(one, (one - t) * _g[0] + t * _g[1]));

+ 1 - 1
include/igl/viridis.cpp

@@ -292,7 +292,7 @@ IGL_INLINE void igl::viridis(const T x_in, T & r, T & g, T & b)
 	T _g[2] = { viridis_cm[least][1], viridis_cm[most][1] };
 	T _b[2] = { viridis_cm[least][2], viridis_cm[most][2] };
 
-	T t = std::max(zero, std::min(one, fmod(x_in_clamped * static_cast<T>(pal), one)));
+	T t = std::max(zero, std::min(one, static_cast<T>(fmod(x_in_clamped * static_cast<T>(pal), one))));
 
 	r = std::max(zero, std::min(one, (one - t) * _r[0] + t * _r[1]));
 	g = std::max(zero, std::min(one, (one - t) * _g[0] + t * _g[1]));