Skip to content

Commit

Permalink
Use one place for vtkCellPtsPtr for visualization and its dependencies.
Browse files Browse the repository at this point in the history
  • Loading branch information
larshg committed Jul 14, 2020
1 parent c1a6fa5 commit 7f8020c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 21 deletions.
14 changes: 4 additions & 10 deletions tools/mesh_sampling.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
*/

#include <pcl/visualization/pcl_visualizer.h>
#include <pcl/visualization/vtk/pcl_vtk_compatibility.h>
#include <pcl/io/pcd_io.h>
#include <pcl/io/vtk_lib_io.h>
#include <pcl/common/transforms.h>
Expand Down Expand Up @@ -87,11 +88,8 @@ randPSurface (vtkPolyData * polydata, std::vector<double> * cumulativeAreas, dou

double A[3], B[3], C[3];
vtkIdType npts = 0;
#ifdef VTK_CELL_ARRAY_V2
vtkIdType const *ptIds = nullptr;
#else
vtkIdType *ptIds = nullptr;
#endif
vtkCellPtsPtr ptIds = nullptr;

polydata->GetCellPoints (el, npts, ptIds);
polydata->GetPoint (ptIds[0], A);
polydata->GetPoint (ptIds[1], B);
Expand Down Expand Up @@ -143,11 +141,7 @@ uniform_sampling (vtkSmartPointer<vtkPolyData> polydata, std::size_t n_samples,
double p1[3], p2[3], p3[3], totalArea = 0;
std::vector<double> cumulativeAreas (cells->GetNumberOfCells (), 0);
vtkIdType npts = 0;
#ifdef VTK_CELL_ARRAY_V2
vtkIdType const *ptIds = nullptr;
#else
vtkIdType *ptIds = nullptr;
#endif
vtkCellPtsPtr ptIds = nullptr;
std::size_t cellId = 0;
for (cells->InitTraversal (); cells->GetNextCell (npts, ptIds); cellId++)
{
Expand Down
14 changes: 3 additions & 11 deletions visualization/src/pcl_visualizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3640,14 +3640,10 @@ pcl::visualization::PCLVisualizer::renderViewTesselatedSphere (
//////////////////////////////
vtkSmartPointer<vtkCellArray> cells = mapper->GetInput ()->GetPolys ();
vtkIdType npts = 0;
#ifdef VTK_CELL_ARRAY_V2
vtkIdType const *ptIds = nullptr;
#else
vtkIdType *ptIds = nullptr;
#endif
vtkCellPtsPtr ptIds = nullptr;

double p1[3], p2[3], p3[3], totalArea = 0;
for (cells->InitTraversal (); cells->GetNextCell (npts, ptIds);)
for (cells->InitTraversal (); cells->GetNextCell(npts, ptIds);)
{
polydata->GetPoint (ptIds[0], p1);
polydata->GetPoint (ptIds[1], p2);
Expand Down Expand Up @@ -3864,11 +3860,7 @@ pcl::visualization::PCLVisualizer::renderViewTesselatedSphere (

vtkSmartPointer<vtkCellArray> cells = polydata->GetPolys ();
vtkIdType npts = 0;
#ifdef VTK_CELL_ARRAY_V2
vtkIdType const *ptIds = nullptr;
#else
vtkIdType *ptIds = nullptr;
#endif
vtkCellPtsPtr ptIds = nullptr;

double p1[3], p2[3], p3[3], area, totalArea = 0;
for (cells->InitTraversal (); cells->GetNextCell (npts, ptIds);)
Expand Down

0 comments on commit 7f8020c

Please sign in to comment.