6#include <Eigen/Geometry>
8#include <SimoxUtility/color/GlasbeyLUT.h>
9#include <SimoxUtility/math/convert/rpy_to_quat.h>
11#include <RobotAPI/interface/ArViz/Elements.h>
17 using data::ColoredPoint;
27 static const AxesFlags AXES_X = {
true,
false,
false,
false};
28 static const AxesFlags AXES_Y = {
false,
true,
false,
false};
29 static const AxesFlags AXES_Z = {
false,
false,
true,
false};
30 static const AxesFlags AXES_XY = {
true,
true,
false,
false};
31 static const AxesFlags AXES_YZ = {
false,
true,
true,
false};
32 static const AxesFlags AXES_XZ = {
true,
false,
true,
false};
33 static const AxesFlags AXES_XYZ = {
true,
true,
true,
false};
42 data_.enableFlags = 0;
49 data_.enableFlags |= data::InteractionEnableFlags::SELECT;
56 data_.enableFlags |= data::InteractionEnableFlags::CONTEXT_MENU;
57 data_.contextMenuOptions = options;
65 data_.enableFlags |= (axes.x ? data::InteractionEnableFlags::TRANSLATION_X : 0);
66 data_.enableFlags |= (axes.y ? data::InteractionEnableFlags::TRANSLATION_Y : 0);
67 data_.enableFlags |= (axes.z ? data::InteractionEnableFlags::TRANSLATION_Z : 0);
75 data_.enableFlags |= (axes.x ? data::InteractionEnableFlags::ROTATION_X : 0);
76 data_.enableFlags |= (axes.y ? data::InteractionEnableFlags::ROTATION_Y : 0);
77 data_.enableFlags |= (axes.z ? data::InteractionEnableFlags::ROTATION_Z : 0);
85 data_.enableFlags |= (axes.x ? data::InteractionEnableFlags::SCALING_X : 0);
86 data_.enableFlags |= (axes.y ? data::InteractionEnableFlags::SCALING_Y : 0);
87 data_.enableFlags |= (axes.z ? data::InteractionEnableFlags::SCALING_Z : 0);
101 data_.enableFlags |= data::InteractionEnableFlags::TRANSFORM_HIDE;
115 template <
typename DerivedT,
typename ElementT>
122 data_->scale.e0 = 1.0f;
123 data_->scale.e1 = 1.0f;
124 data_->scale.e2 = 1.0f;
128 id(
const std::string&
id)
132 return *
static_cast<DerivedT*
>(
this);
142 return *
static_cast<DerivedT*
>(
this);
148 return position(pos.x(), pos.y(), pos.z());
160 return *
static_cast<DerivedT*
>(
this);
172 return orientation(simox::math::rpy_to_quat(r, p, y));
178 return position(
pose.block<3, 1>(0, 3)).orientation(
pose.block<3, 3>(0, 0));
196 return this->
position(pose.translation()).orientation(
pose.linear());
202 auto& p =
data_->pose;
203 Eigen::Matrix4f m = Eigen::Matrix4f::Identity();
207 m.topLeftCorner<3, 3>() =
Eigen::Quaternionf{p.qw, p.qx, p.qy, p.qz}.toRotationMatrix();
222 return *
static_cast<DerivedT*
>(
this);
225 template <
class... Ts>
229 return color({std::forward<Ts>(ts)...});
235 return color(Color::fromRGBA(simox::color::GlasbeyLUT::at(
id, alpha)));
243 data_->flags |= data::ElementFlags::OVERRIDE_MATERIAL;
247 data_->flags &=
~data::ElementFlags::OVERRIDE_MATERIAL;
250 return *
static_cast<DerivedT*
>(
this);
260 return *
static_cast<DerivedT*
>(
this);
270 return *
static_cast<DerivedT*
>(
this);
276 return scale(s, s, s);
282 data_->flags |= data::ElementFlags::HIDDEN;
284 return *
static_cast<DerivedT*
>(
this);
292 return *
static_cast<DerivedT*
>(
this);
311 data_->interaction = interactionDescription.
data_;
312 return *
static_cast<DerivedT*
>(
this);
DerivedT & pose(Eigen::Vector3f const &position, Eigen::Matrix3f const &orientation)
DerivedT & orientation(float r, float p, float y)
DerivedT & enable(InteractionDescription const &interactionDescription)
DerivedT & colorGlasbeyLUT(std::size_t id, int alpha=255)
DerivedT & visible(bool visible)
DerivedT & overrideMaterial(bool value)
DerivedT & scale(float s)
DerivedT & pose(Eigen::Matrix4f const &pose)
DerivedT & id(const std::string &id)
DerivedT & scale(float x, float y, float z)
IceInternal::Handle< ElementT > data_
DerivedT & pose(const Eigen::Affine3f &pose)
ElementOps(std::string const &id)
DerivedT & orientation(Eigen::Matrix3f const &ori)
Eigen::Matrix4f pose() const
DerivedT & color(Color color)
DerivedT & transformPose(Eigen::Matrix4f const &p)
DerivedT & position(float x, float y, float z)
DerivedT & pose(Eigen::Vector3f const &position, Eigen::Quaternionf const &orientation)
DerivedT & orientation(Eigen::Quaternionf const &ori)
DerivedT & scale(Eigen::Vector3f scale)
DerivedT & color(Ts &&... ts)
DerivedT & position(Eigen::Vector3f const &pos)
Quaternion< float, 0 > Quaternionf
This file is part of ArmarX.
InteractionDescription interaction()
This file offers overloads of toIce() and fromIce() functions for STL container types.
Self & rotation(AxesFlags const &axes=AXES_XYZ)
Self & contextMenu(std::vector< std::string > const &options)
InteractionDescription Self
data::InteractionDescription data_
Self & scaling(AxesFlags const &axes=AXES_XYZ)
Self & translation(AxesFlags const &axes=AXES_XYZ)
Self & hideDuringTransform()