Skip to content
Snippets Groups Projects
Commit aa89a38f authored by Rainer Kartmann's avatar Rainer Kartmann
Browse files

Ignore polygons with < 3 points in ArViz visu

parent f58b1b4a
No related branches found
No related tags found
No related merge requests found
......@@ -4,11 +4,14 @@
#include <RobotAPI/interface/ArViz/Elements.h>
#include <ArmarXCore/core/logging/Logging.h>
#include <Inventor/nodes/SoCoordinate3.h>
#include <Inventor/nodes/SoDrawStyle.h>
#include <Inventor/nodes/SoFaceSet.h>
#include <Inventor/nodes/SoLineSet.h>
namespace armarx::viz::coin
{
struct VisualizationPolygon : TypedElementVisualization<SoSeparator>
......@@ -41,6 +44,16 @@ namespace armarx::viz::coin
bool update(ElementType const& element)
{
if (element.points.size() < 3)
{
// A polygon with < 3 points is invalid.
ARMARX_WARNING << deactivateSpam(1000)
<< "Ignoring polygon '" << element.id << "' "
<< "with " << element.points.size() << " points "
<< "(a polygon requires >= 3 points).";
return true;
}
int pointSize = (int)element.points.size();
int i = 0;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment