19 const std::optional<MaskT>& mask,
20 const simox::color::ColorMap& cmap,
21 const std::optional<float>& vmin,
22 const std::optional<float>& vmax)
24 const float vMin = vmin.has_value() ? vmin.value() : grd.minCoeff();
25 const float vMax = vmax.has_value() ? vmax.value() : grd.maxCoeff();
27 const auto colorFn = [cmap, vMin, vMax](
const float val) -> simox::Color
28 {
return cmap.at(val, vMin, vMax); };
30 return grid(grd, mask, colorFn);
36 this->
data_->sizeX = grd.cols();
37 this->
data_->sizeY = grd.rows();
39 auto& colors = this->
data_->colors;
41 colors.reserve(grd.size());
43 for (
int r = 0; r < grd.rows(); ++r)
45 for (
int c = 0;
c < grd.cols(); ++
c)
47 if (mask.has_value() and not mask->operator()(r,
c))
49 colors.emplace_back(0, 0, 0, 0);
53 const auto color = colorFunc(grd(r,
c));
54 colors.push_back(viz::Color::fromRGBA(
color));