5 #include <RobotAPI/interface/ArViz/Elements.h>
8 #include <Inventor/nodes/SoCoordinate3.h>
9 #include <Inventor/nodes/SoDrawStyle.h>
10 #include <Inventor/nodes/SoFaceSet.h>
11 #include <Inventor/nodes/SoLineSet.h>
12 #include <Inventor/nodes/SoMaterial.h>
27 SoSeparator* lineSep =
new SoSeparator;
41 node->addChild(lineSep);
47 if (element.points.size() < 3)
51 <<
"with " << element.points.size() <<
" points "
52 <<
"(a polygon requires >= 3 points).";
56 int pointSize = (int)element.points.size();
60 for (
auto& point : element.points)
62 SbVec3f pt(point.e0, point.e1, point.e2);
70 auto& first = element.points.front();
71 SbVec3f pt0(first.e0, first.e1, first.e2);
75 faceSet->numVertices.set1Value(0, pointSize);
78 const float conv = 1.0f / 255.0f;
79 float r = element.lineColor.r * conv;
80 float g = element.lineColor.g * conv;
81 float b = element.lineColor.b * conv;
82 float a = element.lineColor.a * conv;
87 if (element.lineWidth > 0.0f)
89 lineStyle->lineWidth.setValue(element.lineWidth);
93 lineStyle->style = SoDrawStyleElement::INVISIBLE;
96 lineSet->numVertices.set1Value(0, pointSize + 1);