34 template<
typename DataT>
42 if constexpr(std::is_same_v<DataT, GeometryT::Box>) {
return GeometryT::Type::BOX; }
43 else if constexpr(std::is_same_v<DataT, GeometryT::Cylinder>) {
return GeometryT::Type::CYLINDER; }
44 else if constexpr(std::is_same_v<DataT, GeometryT::Sphere>) {
return GeometryT::Type::SPHERE; }
45 else if constexpr(std::is_same_v<DataT, GeometryT::Mesh>) {
return GeometryT::Type::MESH; }
46 else if constexpr(std::is_same_v<DataT, GeometryT::Superellipsoid>) {
return GeometryT::Type::SUPERELLIPSOID; }
49 static_assert(!std::is_same_v<DataT, DataT>);
58 template<rbd::parsers::Geometry::Type type>
64 if constexpr(type == Type::BOX) {
return boost::get<rbd::parsers::Geometry::Box>(data); }
65 else if constexpr(type == Type::CYLINDER) {
return boost::get<rbd::parsers::Geometry::Cylinder>(data); }
66 else if constexpr(type == Type::SPHERE) {
return boost::get<rbd::parsers::Geometry::Sphere>(data); }
67 else if constexpr(type == Type::MESH) {
return boost::get<rbd::parsers::Geometry::Mesh>(data); }
68 else if constexpr(type == Type::SUPERELLIPSOID) {
return boost::get<rbd::parsers::Geometry::Superellipsoid>(data); }
71 static_assert([] {
return false; }(),
"Unsupported geometry type for getVisualGeometry");
86 inline constexpr
auto getVisualSphere = details::getVisualGeometry<rbd::parsers::Geometry::Type::SPHERE>;
98 inline constexpr
auto getVisualCylinder = details::getVisualGeometry<rbd::parsers::Geometry::Type::CYLINDER>;
109 inline constexpr
auto getVisualBox = details::getVisualGeometry<rbd::parsers::Geometry::Type::BOX>;
123 return makeVisualMesh(path, Eigen::Vector3d(scale, scale, scale));
127 inline constexpr
auto getVisualMesh = details::getVisualGeometry<rbd::parsers::Geometry::Type::MESH>;
144 details::getVisualGeometry<rbd::parsers::Geometry::Type::SUPERELLIPSOID>;
rbd::parsers::Visual makeVisual(const DataT &data, const mc_rtc::gui::Color &color)
Definition: visual_utils.h:35
auto & getVisualGeometry(rbd::parsers::Visual &visual)
Definition: visual_utils.h:59
void setVisualColor(rbd::parsers::Visual &visual, const mc_rtc::gui::Color &color)
Definition: visual_utils.h:20
void error_and_throw(Args &&... args)
Definition: logging.h:40
constexpr auto getVisualCylinder
Definition: visual_utils.h:98
rbd::parsers::Visual makeVisualBox(const Eigen::Vector3d &dim, const mc_rtc::gui::Color &color)
Definition: visual_utils.h:101
rbd::parsers::Visual makeVisualSphere(double radius, const mc_rtc::gui::Color &color)
Definition: visual_utils.h:78
constexpr auto getVisualBox
Definition: visual_utils.h:109
rbd::parsers::Visual makeVisualMesh(const std::string &path, Eigen::Vector3d scaleV)
Definition: visual_utils.h:112
constexpr auto getVisualMesh
Definition: visual_utils.h:127
constexpr auto getVisualSphere
Definition: visual_utils.h:86
rbd::parsers::Visual makeVisualSuperellispoid(const Eigen::Vector3d &size, double epsilon1, double epsilon2, const mc_rtc::gui::Color &color)
Definition: visual_utils.h:130
rbd::parsers::Visual makeVisualCylinder(double radius, double length, const mc_rtc::gui::Color &color)
Definition: visual_utils.h:89
constexpr auto getVisualSuperellipsoid
Definition: visual_utils.h:143
constexpr double epsilon1
double b
Definition: types.h:28
double a
Definition: types.h:29
double g
Definition: types.h:27
double r
Definition: types.h:26