Skip to content

Commit

Permalink
Check coefficients size in PCLVisualizer
Browse files Browse the repository at this point in the history
  • Loading branch information
VictorLamoine committed Feb 12, 2015
1 parent f529736 commit 9560d54
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions visualization/src/pcl_visualizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1995,6 +1995,12 @@ pcl::visualization::PCLVisualizer::addCylinder (const pcl::ModelCoefficients &co
return (false);
}

if (coefficients.values.size () != 7)
{
PCL_WARN ("[addCylinder] Coefficients size does not match expected size (expected 7).\n");
return (false);
}

vtkSmartPointer<vtkDataSet> data = createCylinder (coefficients);

// Create an Actor
Expand Down Expand Up @@ -2022,6 +2028,12 @@ pcl::visualization::PCLVisualizer::addCube (const pcl::ModelCoefficients &coeffi
return (false);
}

if (coefficients.values.size () != 10)
{
PCL_WARN ("[addCube] Coefficients size does not match expected size (expected 10).\n");
return (false);
}

vtkSmartPointer<vtkDataSet> data = createCube (coefficients);

// Create an Actor
Expand Down Expand Up @@ -2109,6 +2121,12 @@ pcl::visualization::PCLVisualizer::addSphere (const pcl::ModelCoefficients &coef
return (false);
}

if (coefficients.values.size () != 4)
{
PCL_WARN ("[addSphere] Coefficients size does not match expected size (expected 4).\n");
return (false);
}

vtkSmartPointer<vtkDataSet> data = createSphere (coefficients);

// Create an Actor
Expand Down Expand Up @@ -2256,6 +2274,12 @@ pcl::visualization::PCLVisualizer::addLine (const pcl::ModelCoefficients &coeffi
return (false);
}

if (coefficients.values.size () != 6)
{
PCL_WARN ("[addLine] Coefficients size does not match expected size (expected 6).\n");
return (false);
}

vtkSmartPointer<vtkDataSet> data = createLine (coefficients);

// Create an Actor
Expand Down Expand Up @@ -2287,6 +2311,12 @@ bool
return (false);
}

if (coefficients.values.size () != 4)
{
PCL_WARN ("[addPlane] Coefficients size does not match expected size (expected 4).\n");
return (false);
}

vtkSmartPointer<vtkDataSet> data = createPlane (coefficients);

// Create an Actor
Expand All @@ -2313,6 +2343,12 @@ bool
return (false);
}

if (coefficients.values.size () != 4)
{
PCL_WARN ("[addPlane] Coefficients size does not match expected size (expected 4).\n");
return (false);
}

vtkSmartPointer<vtkDataSet> data = createPlane (coefficients, x, y, z);

// Create an Actor
Expand All @@ -2339,6 +2375,12 @@ pcl::visualization::PCLVisualizer::addCircle (const pcl::ModelCoefficients &coef
return (false);
}

if (coefficients.values.size () != 3)
{
PCL_WARN ("[addCircle] Coefficients size does not match expected size (expected 3).\n");
return (false);
}

vtkSmartPointer<vtkDataSet> data = create2DCircle (coefficients);

// Create an Actor
Expand All @@ -2365,6 +2407,12 @@ pcl::visualization::PCLVisualizer::addCone (const pcl::ModelCoefficients &coeffi
return (false);
}

if (coefficients.values.size () != 7)
{
PCL_WARN ("[addCone] Coefficients size does not match expected size (expected 7).\n");
return (false);
}

vtkSmartPointer<vtkDataSet> data = createCone (coefficients);

// Create an Actor
Expand Down

0 comments on commit 9560d54

Please sign in to comment.