parula.cpp 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2015 Alec Jacobson <alecjacobson@gmail.com>
  4. //
  5. // This Source Code Form is subject to the terms of the Mozilla Public License
  6. // v. 2.0. If a copy of the MPL was not distributed with this file, You can
  7. // obtain one at http://mozilla.org/MPL/2.0/.
  8. #include "parula.h"
  9. #include "colormap.h"
  10. template <typename T>
  11. IGL_INLINE void igl::parula(const T x, T * rgb)
  12. {
  13. igl::colormap(igl::COLOR_MAP_TYPE_PARULA,x, rgb);
  14. }
  15. template <typename T>
  16. IGL_INLINE void igl::parula(const T f, T & r, T & g, T & b)
  17. {
  18. igl::colormap(igl::COLOR_MAP_TYPE_PARULA, f, r, g, b);
  19. }
  20. template <typename DerivedZ, typename DerivedC>
  21. IGL_INLINE void igl::parula(
  22. const Eigen::MatrixBase<DerivedZ> & Z,
  23. const bool normalize,
  24. Eigen::PlainObjectBase<DerivedC> & C)
  25. {
  26. igl::colormap(igl::COLOR_MAP_TYPE_PARULA, Z, normalize, C);
  27. }
  28. template <typename DerivedZ, typename DerivedC>
  29. IGL_INLINE void igl::parula(
  30. const Eigen::MatrixBase<DerivedZ> & Z,
  31. const double min_z,
  32. const double max_z,
  33. Eigen::PlainObjectBase<DerivedC> & C)
  34. {
  35. igl::colormap(igl::COLOR_MAP_TYPE_PARULA, Z, min_z, max_z, C);
  36. }
  37. #ifdef IGL_STATIC_LIBRARY
  38. // Explicit template instantiation
  39. // generated by autoexplicit.sh
  40. template void igl::parula<Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<double, -1, -1, 0, -1, -1> >(Eigen::MatrixBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, double, double, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&);
  41. // generated by autoexplicit.sh
  42. template void igl::parula<Eigen::Array<int, -1, 1, 0, -1, 1>, Eigen::Matrix<double, -1, -1, 0, -1, -1> >(Eigen::MatrixBase<Eigen::Array<int, -1, 1, 0, -1, 1> > const&, bool, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&);
  43. template void igl::parula<double>(double, double*);
  44. template void igl::parula<double>(double, double&, double&, double&);
  45. template void igl::parula<Eigen::Matrix<double, -1, 1, 0, -1, 1>, Eigen::Matrix<double, -1, -1, 0, -1, -1> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> > const&, bool, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&);
  46. template void igl::parula<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, bool, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&);
  47. template void igl::parula<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, double, double, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&);
  48. #endif