5 #include <RobotAPI/interface/ArViz/Elements.h>
7 #include <VirtualRobot/Visualization/CoinVisualization/CoinVisualizationFactory.h>
8 #include <VirtualRobot/Visualization/CoinVisualization/CoinVisualizationNode.h>
10 #include <Inventor/nodes/SoUnits.h>
20 auto color = element.color;
21 constexpr
float conv = 1.0f / 255.0f;
22 const float r = color.r * conv;
23 const float g = color.g * conv;
24 const float b = color.b * conv;
25 const float a = color.a * conv;
27 VirtualRobot::VisualizationNodePtr cylindroid_node;
30 SoMaterial* mat =
new SoMaterial;
31 mat->diffuseColor.setValue(r, g, b);
32 mat->ambientColor.setValue(r, g, b);
33 mat->transparency.setValue(1. -
a);
35 SoSeparator* res =
new SoSeparator();
37 SoUnits* u =
new SoUnits();
38 u->units = SoUnits::MILLIMETERS;
40 res->addChild(VirtualRobot::CoinVisualizationFactory::CreateCylindroid(
41 element.axisLengths.e0, element.axisLengths.e1, element.height,
44 cylindroid_node.reset(
new VirtualRobot::CoinVisualizationNode(res));
48 SoNode* cylindroid =
dynamic_cast<VirtualRobot::CoinVisualizationNode&
>(
49 *cylindroid_node).getCoinVisualization();
51 node->removeAllChildren();
52 node->addChild(cylindroid);