Closed majia67 closed 6 years ago
It's not implemented natively, but it is possible. The easiest thing to do is scale your scalar to (0,1), say S and use a colormap as R=G=B=S.
If you want some fancier things done, you can refer to the source code here https://github.com/libigl/libigl/blob/master/include/igl/colormap.cpp
and plugin the colorscales encoding from https://matplotlib.org/tutorials/colors/colormaps.html
@jiangzhongshi Thank you for your reply! How could I specify a colormap as R=G=B=S in libigl? I looked at the "colormap" function in libigl and it seems like all colormap types are predefined.
For this simple case, you don't need to use colormap
function (you can modify it nonetheless).
Just set
MatrixXd C;
C.col(0) = S;
C.col(1) = S;
C.col(2) = S;
And this is the color matrix you want (be sure to scale S to 0-1 beforehand)
Wow! I'm stupid. Thanks a lot!
Is it possible for libigl to generate a color map for a scalar function in gray scale?