Sphere.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <mc_rtc/gui/Visual.h>
4 #include <mc_rtc/visual_utils.h>
5 
6 namespace mc_rtc::gui
7 {
8 
19 template<typename GetPos, typename GetRadius = double, typename GetColor = const mc_rtc::gui::Color &>
20 auto Sphere(const std::string & name,
21  GetRadius radius_fn,
22  GetPos get_pos_fn,
23  GetColor color_fn = mc_rtc::gui::Color::Red)
24 {
25  auto sphere =
27  auto get_visual_fn = [=]() mutable -> const rbd::parsers::Visual &
28  {
29  if constexpr(std::is_invocable_v<GetRadius>) { mc_rtc::getVisualSphere(sphere).radius = radius_fn(); }
30  if constexpr(std::is_invocable_v<GetColor>) { mc_rtc::details::setVisualColor(sphere, color_fn()); }
31  return sphere;
32  };
33  return Visual(name, get_visual_fn, get_pos_fn);
34 }
35 
36 } // namespace mc_rtc::gui
Visual.h
mc_rtc::gui::Sphere
auto Sphere(const std::string &name, GetRadius radius_fn, GetPos get_pos_fn, GetColor color_fn=mc_rtc::gui::Color::Red)
Definition: Sphere.h:20
mc_rtc::getVisualSphere
constexpr auto getVisualSphere
Definition: visual_utils.h:80
mc_rtc::gui::Color::Red
static const Color Red
Definition: types.h:102
mc_rtc::gui::details::GetValueOrCallbackValue
auto GetValueOrCallbackValue(const T &value_or_cb)
Definition: traits.h:231
visual_utils.h
mc_rtc::makeVisualSphere
rbd::parsers::Visual makeVisualSphere(double radius, const mc_rtc::gui::Color &color)
Definition: visual_utils.h:72
mc_rtc::details::setVisualColor
void setVisualColor(rbd::parsers::Visual &visual, const mc_rtc::gui::Color &color)
Definition: visual_utils.h:20
mc_rtc::gui::Visual
auto Visual(const std::string &name, GetVisual get_visual_fn, GetPos get_pos_fn)
Definition: Visual.h:64
mc_rtc::gui
Definition: Observer.h:15