heatmap.h
Go to the documentation of this file.
1
#pragma once
2
#include <Eigen/Core>
3
4
namespace
mc_rtc
5
{
6
namespace
utils
7
{
8
23
template
<
typename
T>
24
T
heatmap
(
double
minimum,
double
maximum,
double
value)
25
{
26
if
(value > maximum) {
return
{1, 0, 0}; }
27
if
(value < minimum) {
return
{0, 0, 1}; }
28
29
const
auto
ratio = 2 * (value - minimum) / (maximum - minimum);
30
const
auto
b = std::max(0., (1 - ratio));
31
const
auto
r = std::max(0., (ratio - 1));
32
const
auto
g = 1 - b - r;
33
return
{r, g, b};
34
}
35
36
}
// namespace utils
37
}
// namespace mc_rtc
mc_rtc::utils::heatmap
T heatmap(double minimum, double maximum, double value)
Compute rgb heatmap colors expressed between 0 and 1.
Definition:
heatmap.h:24
mc_rtc
Definition:
Contact.h:87
include
mc_rtc
utils
heatmap.h
Generated by
1.8.17