Ellipsoid.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 GetSize = const Eigen::Vector3d &, typename GetColor = const mc_rtc::gui::Color &>
20 auto Ellipsoid(const std::string & name,
21  GetSize size_fn,
22  GetPos get_pos_fn,
23  GetColor color_fn = mc_rtc::gui::Color::Red)
24 {
25  auto ellipsoid = mc_rtc::makeVisualSuperellispoid(details::GetValueOrCallbackValue(size_fn), 1.0, 1.0,
27  auto get_visual_fn = [=]() mutable -> const rbd::parsers::Visual &
28  {
29  if constexpr(std::is_invocable_v<GetSize>) { mc_rtc::getVisualSuperellipsoid(ellipsoid).size = size_fn(); }
30  if constexpr(std::is_invocable_v<GetColor>) { mc_rtc::details::setVisualColor(ellipsoid, color_fn()); }
31  return ellipsoid;
32  };
33  return Visual(name, get_visual_fn, get_pos_fn);
34 }
35 
36 } // namespace mc_rtc::gui
Visual.h
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::details::setVisualColor
void setVisualColor(rbd::parsers::Visual &visual, const mc_rtc::gui::Color &color)
Definition: visual_utils.h:20
mc_rtc::gui::Ellipsoid
auto Ellipsoid(const std::string &name, GetSize size_fn, GetPos get_pos_fn, GetColor color_fn=mc_rtc::gui::Color::Red)
Definition: Ellipsoid.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::getVisualSuperellipsoid
constexpr auto getVisualSuperellipsoid
Definition: visual_utils.h:137
mc_rtc::gui
Definition: Observer.h:15
mc_rtc::makeVisualSuperellispoid
rbd::parsers::Visual makeVisualSuperellispoid(const Eigen::Vector3d &size, double epsilon1, double epsilon2, const mc_rtc::gui::Color &color)
Definition: visual_utils.h:124