5 #include <RobotAPI/interface/ArViz/Elements.h>
9 #include <Inventor/nodes/SoCoordinate3.h>
10 #include <Inventor/nodes/SoDrawStyle.h>
11 #include <Inventor/nodes/SoFaceSet.h>
12 #include <Inventor/nodes/SoLineSet.h>
28 SoSeparator* lineSep =
new SoSeparator;
42 node->addChild(lineSep);
47 if (element.points.size() < 3)
51 <<
"Ignoring polygon '" << element.id <<
"' "
52 <<
"with " << element.points.size() <<
" points "
53 <<
"(a polygon requires >= 3 points).";
57 int pointSize = (int)element.points.size();
61 for (
auto& point : element.points)
63 SbVec3f pt(point.e0, point.e1, point.e2);
71 auto& first = element.points.front();
72 SbVec3f pt0(first.e0, first.e1, first.e2);
76 faceSet->numVertices.set1Value(0, pointSize);
79 const float conv = 1.0f / 255.0f;
80 float r = element.lineColor.r * conv;
81 float g = element.lineColor.g * conv;
82 float b = element.lineColor.b * conv;
83 float a = element.lineColor.a * conv;
88 if (element.lineWidth > 0.0f)
90 lineStyle->lineWidth.setValue(element.lineWidth);
94 lineStyle->style = SoDrawStyleElement::INVISIBLE;
97 lineSet->numVertices.set1Value(0, pointSize + 1);