38#ifndef PCL_PCL_VISUALIZER_IMPL_H_
39#define PCL_PCL_VISUALIZER_IMPL_H_
41#include <vtkVersion.h>
42#include <vtkSmartPointer.h>
43#include <vtkCellArray.h>
44#include <vtkLeaderActor2D.h>
45#include <vtkVectorText.h>
46#include <vtkAlgorithmOutput.h>
47#include <vtkFollower.h>
50#include <vtkSphereSource.h>
51#include <vtkProperty2D.h>
52#include <vtkDataSetSurfaceFilter.h>
53#include <vtkPointData.h>
54#include <vtkPolyDataMapper.h>
55#include <vtkProperty.h>
57#include <vtkCellData.h>
58#include <vtkDataSetMapper.h>
59#include <vtkRenderer.h>
60#include <vtkRendererCollection.h>
61#include <vtkAppendPolyData.h>
62#include <vtkTextProperty.h>
63#include <vtkLODActor.h>
64#include <vtkLineSource.h>
66#include <pcl/common/utils.h>
72#ifdef vtkGenericDataArray_h
73#define SetTupleValue SetTypedTuple
74#define InsertNextTupleValue InsertNextTypedTuple
75#define GetTupleValue GetTypedTuple
79template <
typename Po
intT>
bool
82 const std::string &
id,
int viewport)
86 return (addPointCloud<PointT> (cloud, geometry_handler,
id, viewport));
90template <
typename Po
intT>
bool
94 const std::string &
id,
int viewport)
98 PCL_WARN (
"[addPointCloud] The id <%s> already exists! Please choose a different id and retry.\n",
id.c_str ());
112template <
typename Po
intT>
bool
116 const std::string &
id,
int viewport)
122 auto am_it = cloud_actor_map_->find (
id);
123 am_it->second.geometry_handlers.push_back (geometry_handler);
133template <
typename Po
intT>
bool
137 const std::string &
id,
int viewport)
141 PCL_WARN (
"[addPointCloud] The id <%s> already exists! Please choose a different id and retry.\n",
id.c_str ());
155template <
typename Po
intT>
bool
159 const std::string &
id,
int viewport)
162 auto am_it = cloud_actor_map_->find (
id);
163 if (am_it != cloud_actor_map_->end ())
167 am_it->second.color_handlers.push_back (color_handler);
176template <
typename Po
intT>
bool
181 const std::string &
id,
int viewport)
184 auto am_it = cloud_actor_map_->find (
id);
185 if (am_it != cloud_actor_map_->end ())
189 am_it->second.geometry_handlers.push_back (geometry_handler);
190 am_it->second.color_handlers.push_back (color_handler);
197template <
typename Po
intT>
bool
202 const std::string &
id,
int viewport)
206 PCL_WARN (
"[addPointCloud] The id <%s> already exists! Please choose a different id and retry.\n",
id.c_str ());
218template <
typename Po
intT>
void
219pcl::visualization::PCLVisualizer::convertPointCloudToVTKPolyData (
227 allocVtkPolyData (polydata);
229 polydata->SetVerts (vertices);
233#ifndef VTK_CELL_ARRAY_V2
234 vertices = polydata->GetVerts ();
239 vtkIdType nr_points = cloud->
size ();
245 points->SetDataTypeToFloat ();
246 polydata->SetPoints (points);
248 points->SetNumberOfPoints (nr_points);
251 float *data = (
dynamic_cast<vtkFloatArray*
> (points->GetData ()))->GetPointer (0);
257 for (vtkIdType i = 0; i < nr_points; ++i, ptr += 3) {
258 std::copy(&(*cloud)[i].x, &(*cloud)[i].x + 3, &data[ptr]);
264 for (vtkIdType i = 0; i < nr_points; ++i)
270 std::copy (&(*cloud)[i].x, &(*cloud)[i].x + 3, &data[ptr]);
275 points->SetNumberOfPoints (nr_points);
278#ifdef VTK_CELL_ARRAY_V2
282 auto numOfCells = vertices->GetNumberOfCells();
285 if (numOfCells < nr_points)
287 for (
int i = numOfCells; i < nr_points; i++)
289 vertices->InsertNextCell(1);
290 vertices->InsertCellPoint(i);
294 else if (numOfCells > nr_points)
296 vertices->ResizeExact(nr_points, nr_points);
299 polydata->SetPoints(points);
300 polydata->SetVerts(vertices);
304 updateCells (cells, initcells, nr_points);
307 vertices->SetCells (nr_points, cells);
310 vertices->SetNumberOfCells(nr_points);
315template <
typename Po
intT>
void
316pcl::visualization::PCLVisualizer::convertPointCloudToVTKPolyData (
324 allocVtkPolyData (polydata);
326 polydata->SetVerts (vertices);
332 polydata->SetPoints (points);
334 vtkIdType nr_points = points->GetNumberOfPoints ();
337#ifndef VTK_CELL_ARRAY_V2
338 vertices = polydata->GetVerts ();
343#ifdef VTK_CELL_ARRAY_V2
347 auto numOfCells = vertices->GetNumberOfCells();
350 if (numOfCells < nr_points)
352 for (
int i = numOfCells; i < nr_points; i++)
354 vertices->InsertNextCell(1);
355 vertices->InsertCellPoint(i);
359 else if (numOfCells > nr_points)
361 vertices->ResizeExact(nr_points, nr_points);
364 polydata->SetPoints(points);
365 polydata->SetVerts(vertices);
369 updateCells (cells, initcells, nr_points);
371 vertices->SetCells (nr_points, cells);
376template <
typename Po
intT>
bool
379 double r,
double g,
double b,
const std::string &
id,
int viewport)
386 auto am_it = shape_actor_map_->find (
id);
387 if (am_it != shape_actor_map_->end ())
392 all_data->AddInputData (
reinterpret_cast<vtkPolyDataMapper*
> ((vtkActor::SafeDownCast (am_it->second))->GetMapper ())->GetInput ());
396 surface_filter->AddInputData (vtkUnstructuredGrid::SafeDownCast (data));
398 all_data->AddInputData (poly_data);
402 createActorFromVTKDataSet (all_data->GetOutput (), actor);
403 actor->GetProperty ()->SetRepresentationToWireframe ();
404 actor->GetProperty ()->SetColor (r, g, b);
405 actor->GetMapper ()->ScalarVisibilityOff ();
406 removeActorFromRenderer (am_it->second, viewport);
407 addActorToRenderer (actor, viewport);
410 (*shape_actor_map_)[id] = actor;
416 createActorFromVTKDataSet (data, actor);
417 actor->GetProperty ()->SetRepresentationToWireframe ();
418 actor->GetProperty ()->SetColor (r, g, b);
419 actor->GetMapper ()->ScalarVisibilityOff ();
420 addActorToRenderer (actor, viewport);
423 (*shape_actor_map_)[id] = actor;
430template <
typename Po
intT>
bool
433 double r,
double g,
double b,
const std::string &
id,
int viewport)
440 auto am_it = shape_actor_map_->find (
id);
441 if (am_it != shape_actor_map_->end ())
446 all_data->AddInputData (
reinterpret_cast<vtkPolyDataMapper*
> ((vtkActor::SafeDownCast (am_it->second))->GetMapper ())->GetInput ());
450 surface_filter->SetInputData (vtkUnstructuredGrid::SafeDownCast (data));
452 all_data->AddInputData (poly_data);
456 createActorFromVTKDataSet (all_data->GetOutput (), actor);
457 actor->GetProperty ()->SetRepresentationToWireframe ();
458 actor->GetProperty ()->SetColor (r, g, b);
459 actor->GetMapper ()->ScalarVisibilityOn ();
460 actor->GetProperty ()->BackfaceCullingOff ();
461 removeActorFromRenderer (am_it->second, viewport);
462 addActorToRenderer (actor, viewport);
465 (*shape_actor_map_)[id] = actor;
471 createActorFromVTKDataSet (data, actor);
472 actor->GetProperty ()->SetRepresentationToWireframe ();
473 actor->GetProperty ()->SetColor (r, g, b);
474 actor->GetMapper ()->ScalarVisibilityOn ();
475 actor->GetProperty ()->BackfaceCullingOff ();
476 addActorToRenderer (actor, viewport);
479 (*shape_actor_map_)[id] = actor;
485template <
typename Po
intT>
bool
488 const std::string &
id,
int viewport)
490 return (addPolygon<PointT> (cloud, 0.5, 0.5, 0.5,
id, viewport));
494template <
typename P1,
typename P2>
bool
499 PCL_WARN (
"[addLine] The id <%s> already exists! Please choose a different id and retry.\n",
id.c_str ());
507 createActorFromVTKDataSet (data, actor);
508 actor->GetProperty ()->SetRepresentationToWireframe ();
509 actor->GetProperty ()->SetColor (r, g, b);
510 actor->GetMapper ()->ScalarVisibilityOff ();
511 addActorToRenderer (actor, viewport);
514 (*shape_actor_map_)[id] = actor;
519template <
typename P1,
typename P2>
bool
524 PCL_WARN (
"[addArrow] The id <%s> already exists! Please choose a different id and retry.\n",
id.c_str ());
530 leader->GetPositionCoordinate ()->SetCoordinateSystemToWorld ();
531 leader->GetPositionCoordinate ()->SetValue (pt1.x, pt1.y, pt1.z);
532 leader->GetPosition2Coordinate ()->SetCoordinateSystemToWorld ();
533 leader->GetPosition2Coordinate ()->SetValue (pt2.x, pt2.y, pt2.z);
534 leader->SetArrowStyleToFilled ();
535 leader->AutoLabelOn ();
537 leader->GetProperty ()->SetColor (r, g, b);
538 addActorToRenderer (leader, viewport);
541 (*shape_actor_map_)[id] = leader;
546template <
typename P1,
typename P2>
bool
551 PCL_WARN (
"[addArrow] The id <%s> already exists! Please choose a different id and retry.\n",
id.c_str ());
557 leader->GetPositionCoordinate ()->SetCoordinateSystemToWorld ();
558 leader->GetPositionCoordinate ()->SetValue (pt1.x, pt1.y, pt1.z);
559 leader->GetPosition2Coordinate ()->SetCoordinateSystemToWorld ();
560 leader->GetPosition2Coordinate ()->SetValue (pt2.x, pt2.y, pt2.z);
561 leader->SetArrowStyleToFilled ();
562 leader->SetArrowPlacementToPoint1 ();
564 leader->AutoLabelOn ();
566 leader->AutoLabelOff ();
568 leader->GetProperty ()->SetColor (r, g, b);
569 addActorToRenderer (leader, viewport);
572 (*shape_actor_map_)[id] = leader;
576template <
typename P1,
typename P2>
bool
578 double r_line,
double g_line,
double b_line,
579 double r_text,
double g_text,
double b_text,
580 const std::string &
id,
int viewport)
584 PCL_WARN (
"[addArrow] The id <%s> already exists! Please choose a different id and retry.\n",
id.c_str ());
590 leader->GetPositionCoordinate ()->SetCoordinateSystemToWorld ();
591 leader->GetPositionCoordinate ()->SetValue (pt1.x, pt1.y, pt1.z);
592 leader->GetPosition2Coordinate ()->SetCoordinateSystemToWorld ();
593 leader->GetPosition2Coordinate ()->SetValue (pt2.x, pt2.y, pt2.z);
594 leader->SetArrowStyleToFilled ();
595 leader->AutoLabelOn ();
597 leader->GetLabelTextProperty()->SetColor(r_text, g_text, b_text);
599 leader->GetProperty ()->SetColor (r_line, g_line, b_line);
600 addActorToRenderer (leader, viewport);
603 (*shape_actor_map_)[id] = leader;
608template <
typename P1,
typename P2>
bool
611 return (addLine (pt1, pt2, 0.5, 0.5, 0.5,
id, viewport));
615template <
typename Po
intT>
bool
620 PCL_WARN (
"[addSphere] The id <%s> already exists! Please choose a different id and retry.\n",
id.c_str ());
625 data->SetRadius (radius);
626 data->SetCenter (
static_cast<double>(center.x),
static_cast<double>(center.y),
static_cast<double>(center.z));
627 data->SetPhiResolution (10);
628 data->SetThetaResolution (10);
629 data->LatLongTessellationOff ();
634 mapper->SetInputConnection (data->GetOutputPort ());
638 actor->SetMapper (mapper);
640 actor->GetProperty ()->SetRepresentationToSurface ();
641 actor->GetProperty ()->SetInterpolationToFlat ();
642 actor->GetProperty ()->SetColor (r, g, b);
643 actor->GetMapper ()->StaticOn ();
644 actor->GetMapper ()->ScalarVisibilityOff ();
645 actor->GetMapper ()->Update ();
646 addActorToRenderer (actor, viewport);
649 (*shape_actor_map_)[id] = actor;
654template <
typename Po
intT>
bool
657 return (addSphere (center, radius, 0.5, 0.5, 0.5,
id, viewport));
661template<
typename Po
intT>
bool
671 auto am_it = shape_actor_map_->find (
id);
672 vtkLODActor* actor = vtkLODActor::SafeDownCast (am_it->second);
675 vtkAlgorithm *algo = actor->GetMapper ()->GetInputAlgorithm ();
676 vtkSphereSource *src = vtkSphereSource::SafeDownCast (algo);
680 src->SetCenter (
double (center.x), double (center.y), double (center.z));
681 src->SetRadius (radius);
683 actor->GetProperty ()->SetColor (r, g, b);
690template <
typename Po
intT>
bool
692 const std::string &text,
698 const std::string &
id,
711 if (rens_->GetNumberOfItems () <= viewport)
713 PCL_ERROR (
"[addText3D] The viewport [%d] doesn't exist (id <%s>)! \n",
720 rens_->InitTraversal ();
721 for (std::size_t i = viewport; rens_->GetNextItem (); ++i)
723 const std::string uid = tid + std::string (i,
'*');
726 PCL_ERROR (
"[addText3D] The id <%s> already exists in viewport [%d]! \n"
727 "Please choose a different id and retry.\n",
738 textSource->SetText (text.c_str());
739 textSource->Update ();
742 textMapper->SetInputConnection (textSource->GetOutputPort ());
745 rens_->InitTraversal ();
746 vtkRenderer* renderer;
748 while ((renderer = rens_->GetNextItem ()))
751 if (viewport == 0 || viewport == i)
754 textActor->SetMapper (textMapper);
755 textActor->SetPosition (position.x, position.y, position.z);
756 textActor->SetScale (textScale);
757 textActor->GetProperty ()->SetColor (r, g, b);
758 textActor->SetCamera (renderer->GetActiveCamera ());
760 renderer->AddActor (textActor);
764 const std::string uid = tid + std::string (i,
'*');
765 (*shape_actor_map_)[uid] = textActor;
775template <
typename Po
intT>
bool
777 const std::string &text,
779 double orientation[3],
784 const std::string &
id,
797 if (rens_->GetNumberOfItems () <= viewport)
799 PCL_ERROR (
"[addText3D] The viewport [%d] doesn't exist (id <%s>)!\n",
806 rens_->InitTraversal ();
807 for (std::size_t i = viewport; rens_->GetNextItem (); ++i)
809 const std::string uid = tid + std::string (i,
'*');
812 PCL_ERROR (
"[addText3D] The id <%s> already exists in viewport [%d]! "
813 "Please choose a different id and retry.\n",
824 textSource->SetText (text.c_str());
825 textSource->Update ();
828 textMapper->SetInputConnection (textSource->GetOutputPort ());
831 textActor->SetMapper (textMapper);
832 textActor->SetPosition (position.x, position.y, position.z);
833 textActor->SetScale (textScale);
834 textActor->GetProperty ()->SetColor (r, g, b);
835 textActor->SetOrientation (orientation);
838 rens_->InitTraversal ();
840 for ( vtkRenderer* renderer = rens_->GetNextItem ();
842 renderer = rens_->GetNextItem (), ++i)
844 if (viewport == 0 || viewport == i)
846 renderer->AddActor (textActor);
847 const std::string uid = tid + std::string (i,
'*');
848 (*shape_actor_map_)[uid] = textActor;
856template <
typename Po
intNT>
bool
859 int level,
float scale,
const std::string &
id,
int viewport)
861 return (addPointCloudNormals<PointNT, PointNT> (cloud, cloud, level, scale,
id, viewport));
865template <
typename Po
intT,
typename Po
intNT>
bool
869 int level,
float scale,
870 const std::string &
id,
int viewport)
872 if (normals->
size () != cloud->
size ())
874 PCL_ERROR (
"[addPointCloudNormals] The number of points differs from the number of normals!\n");
878 if (normals->
empty ())
880 PCL_WARN (
"[addPointCloudNormals] An empty normal cloud is given! Nothing to display.\n");
886 PCL_WARN (
"[addPointCloudNormals] The id <%s> already exists! Please choose a different id and retry.\n",
id.c_str ());
893 points->SetDataTypeToFloat ();
895 data->SetNumberOfComponents (3);
898 vtkIdType nr_normals = 0;
899 float* pts =
nullptr;
904 auto point_step =
static_cast<vtkIdType
> (sqrt (
static_cast<double>(level)));
905 nr_normals = (
static_cast<vtkIdType
> ((cloud->
width - 1)/ point_step) + 1) *
906 (
static_cast<vtkIdType
> ((cloud->
height - 1) / point_step) + 1);
907 pts =
new float[2 * nr_normals * 3];
909 vtkIdType cell_count = 0;
910 for (vtkIdType y = 0; y < normals->
height; y += point_step)
911 for (vtkIdType x = 0; x < normals->
width; x += point_step)
913 PointT p = (*cloud)(x, y);
916 p.x += (*normals)(x, y).normal[0] * scale;
917 p.y += (*normals)(x, y).normal[1] * scale;
918 p.z += (*normals)(x, y).normal[2] * scale;
920 pts[2 * cell_count * 3 + 0] = (*cloud)(x, y).x;
921 pts[2 * cell_count * 3 + 1] = (*cloud)(x, y).y;
922 pts[2 * cell_count * 3 + 2] = (*cloud)(x, y).z;
923 pts[2 * cell_count * 3 + 3] = p.x;
924 pts[2 * cell_count * 3 + 4] = p.y;
925 pts[2 * cell_count * 3 + 5] = p.z;
927 lines->InsertNextCell (2);
928 lines->InsertCellPoint (2 * cell_count);
929 lines->InsertCellPoint (2 * cell_count + 1);
932 nr_normals = cell_count;
936 nr_normals = (cloud->
size () - 1) / level + 1 ;
937 pts =
new float[2 * nr_normals * 3];
940 for (vtkIdType i = 0; (j < nr_normals) && (i < static_cast<vtkIdType>(cloud->
size())); i += level)
945 p.x += (*normals)[i].normal[0] * scale;
946 p.y += (*normals)[i].normal[1] * scale;
947 p.z += (*normals)[i].normal[2] * scale;
949 pts[2 * j * 3 + 0] = (*cloud)[i].x;
950 pts[2 * j * 3 + 1] = (*cloud)[i].y;
951 pts[2 * j * 3 + 2] = (*cloud)[i].z;
952 pts[2 * j * 3 + 3] = p.x;
953 pts[2 * j * 3 + 4] = p.y;
954 pts[2 * j * 3 + 5] = p.z;
956 lines->InsertNextCell (2);
957 lines->InsertCellPoint (2 * j);
958 lines->InsertCellPoint (2 * j + 1);
964 data->SetArray (&pts[0], 2 * nr_normals * 3, 0, vtkFloatArray::VTK_DATA_ARRAY_DELETE);
965 points->SetData (data);
968 polyData->SetPoints (points);
969 polyData->SetLines (lines);
972 mapper->SetInputData (polyData);
973 mapper->SetColorModeToMapScalars();
974 mapper->SetScalarModeToUsePointData();
978 actor->SetMapper (mapper);
983 actor->SetUserMatrix (transformation);
986 addActorToRenderer (actor, viewport);
989 (*cloud_actor_map_)[id].actor = actor;
994template <
typename Po
intNT>
bool
998 int level,
float scale,
999 const std::string &
id,
int viewport)
1001 return (addPointCloudPrincipalCurvatures<PointNT, PointNT> (cloud, cloud, pcs, level, scale,
id, viewport));
1005template <
typename Po
intT,
typename Po
intNT>
bool
1010 int level,
float scale,
1011 const std::string &
id,
int viewport)
1015 pcl::console::print_error (
"[addPointCloudPrincipalCurvatures] The number of points differs from the number of principal curvatures/normals!\n");
1021 PCL_WARN (
"[addPointCloudPrincipalCurvatures] The id <%s> already exists! Please choose a different id and retry.\n",
id.c_str ());
1029 unsigned char green[3] = {0, 255, 0};
1030 unsigned char blue[3] = {0, 0, 255};
1034 line_1_colors->SetNumberOfComponents (3);
1035 line_1_colors->SetName (
"Colors");
1037 line_2_colors->SetNumberOfComponents (3);
1038 line_2_colors->SetName (
"Colors");
1041 for (std::size_t i = 0; i < cloud->
size (); i+=level)
1044 p.x += ((*pcs)[i].pc1 * (*pcs)[i].principal_curvature[0]) * scale;
1045 p.y += ((*pcs)[i].pc1 * (*pcs)[i].principal_curvature[1]) * scale;
1046 p.z += ((*pcs)[i].pc1 * (*pcs)[i].principal_curvature[2]) * scale;
1049 line_1->SetPoint1 ((*cloud)[i].x, (*cloud)[i].y, (*cloud)[i].z);
1050 line_1->SetPoint2 (p.x, p.y, p.z);
1052 polydata_1->AddInputData (line_1->GetOutput ());
1053 line_1_colors->InsertNextTupleValue (green);
1055 polydata_1->Update ();
1057 line_1_data->GetCellData ()->SetScalars (line_1_colors);
1060 for (std::size_t i = 0; i < cloud->
size (); i += level)
1062 Eigen::Vector3f pc ((*pcs)[i].principal_curvature[0],
1063 (*pcs)[i].principal_curvature[1],
1064 (*pcs)[i].principal_curvature[2]);
1065 Eigen::Vector3f normal ((*normals)[i].normal[0],
1066 (*normals)[i].normal[1],
1067 (*normals)[i].normal[2]);
1068 Eigen::Vector3f pc_c = pc.cross (normal);
1071 p.x += ((*pcs)[i].pc2 * pc_c[0]) * scale;
1072 p.y += ((*pcs)[i].pc2 * pc_c[1]) * scale;
1073 p.z += ((*pcs)[i].pc2 * pc_c[2]) * scale;
1076 line_2->SetPoint1 ((*cloud)[i].x, (*cloud)[i].y, (*cloud)[i].z);
1077 line_2->SetPoint2 (p.x, p.y, p.z);
1079 polydata_2->AddInputData (line_2->GetOutput ());
1081 line_2_colors->InsertNextTupleValue (blue);
1083 polydata_2->Update ();
1085 line_2_data->GetCellData ()->SetScalars (line_2_colors);
1089 alldata->AddInputData (line_1_data);
1090 alldata->AddInputData (line_2_data);
1095 createActorFromVTKDataSet (alldata->GetOutput (), actor);
1096 actor->GetMapper ()->SetScalarModeToUseCellData ();
1099 addActorToRenderer (actor, viewport);
1104 (*cloud_actor_map_)[id] = act;
1109template <
typename Po
intT,
typename GradientT>
bool
1113 int level,
double scale,
1114 const std::string &
id,
int viewport)
1116 if (gradients->
size () != cloud->
size ())
1118 PCL_ERROR (
"[addPointCloudGradients] The number of points differs from the number of gradients!\n");
1123 PCL_WARN (
"[addPointCloudGradients] The id <%s> already exists! Please choose a different id and retry.\n",
id.c_str ());
1130 points->SetDataTypeToFloat ();
1132 data->SetNumberOfComponents (3);
1134 vtkIdType nr_gradients = (cloud->
size () - 1) / level + 1 ;
1135 float* pts =
new float[2 * nr_gradients * 3];
1137 for (vtkIdType i = 0, j = 0; j < nr_gradients; j++, i = j * level)
1140 p.x += (*gradients)[i].gradient[0] * scale;
1141 p.y += (*gradients)[i].gradient[1] * scale;
1142 p.z += (*gradients)[i].gradient[2] * scale;
1144 pts[2 * j * 3 + 0] = (*cloud)[i].x;
1145 pts[2 * j * 3 + 1] = (*cloud)[i].y;
1146 pts[2 * j * 3 + 2] = (*cloud)[i].z;
1147 pts[2 * j * 3 + 3] = p.x;
1148 pts[2 * j * 3 + 4] = p.y;
1149 pts[2 * j * 3 + 5] = p.z;
1151 lines->InsertNextCell(2);
1152 lines->InsertCellPoint(2*j);
1153 lines->InsertCellPoint(2*j+1);
1156 data->SetArray (&pts[0], 2 * nr_gradients * 3, 0, vtkFloatArray::VTK_DATA_ARRAY_DELETE);
1157 points->SetData (data);
1160 polyData->SetPoints(points);
1161 polyData->SetLines(lines);
1164 mapper->SetInputData (polyData);
1165 mapper->SetColorModeToMapScalars();
1166 mapper->SetScalarModeToUsePointData();
1170 actor->SetMapper (mapper);
1173 addActorToRenderer (actor, viewport);
1176 (*cloud_actor_map_)[id].actor = actor;
1181template <
typename Po
intT>
bool
1185 const std::vector<int> &correspondences,
1186 const std::string &
id,
1190 corrs.resize (correspondences.size ());
1192 std::size_t index = 0;
1193 for (
auto &corr : corrs)
1195 corr.index_query = index;
1196 corr.index_match = correspondences[index];
1200 return (addCorrespondences<PointT> (source_points, target_points, corrs,
id, viewport));
1204template <
typename Po
intT>
bool
1210 const std::string &
id,
1214 if (correspondences.empty ())
1216 PCL_DEBUG (
"[addCorrespondences] An empty set of correspondences given! Nothing to display.\n");
1221 auto am_it = shape_actor_map_->find (
id);
1222 if (am_it != shape_actor_map_->end () && !overwrite)
1224 PCL_WARN (
"[addCorrespondences] A set of correspondences with id <%s> already exists! Please choose a different id and retry.\n",
id.c_str ());
1227 if (am_it == shape_actor_map_->end () && overwrite)
1232 Eigen::Affine3f source_transformation;
1234 source_transformation.translation () = source_points->
sensor_origin_.template head<3> ();
1235 Eigen::Affine3f target_transformation;
1237 target_transformation.translation () = target_points->
sensor_origin_.template head<3> ();
1239 const int n_corr =
static_cast<int>(std::ceil(
static_cast<float>(correspondences.size ()) / nth));
1244 line_colors->SetNumberOfComponents (3);
1245 line_colors->SetName (
"Colors");
1246 line_colors->SetNumberOfTuples (n_corr);
1252#if VTK_MAJOR_VERSION > 9 || (VTK_MAJOR_VERSION == 9 && VTK_MINOR_VERSION >= 6)
1255 for (std::size_t i = 0; i < correspondences.size (); i += nth)
1257 if (correspondences[i].index_match ==
UNAVAILABLE)
1259 PCL_WARN (
"[addCorrespondences] No valid index_match for correspondence %d\n", i);
1263 PointT p_src ((*source_points)[correspondences[i].index_query]);
1264 PointT p_tgt ((*target_points)[correspondences[i].index_match]);
1266 p_src.getVector3fMap () = source_transformation * p_src.getVector3fMap ();
1267 p_tgt.getVector3fMap () = target_transformation * p_tgt.getVector3fMap ();
1269 int id1 = j * 2, id2 = j * 2 + 1;
1271 line_points->InsertNextPoint(p_src.x, p_src.y, p_src.z);
1272 line_points->InsertNextPoint(p_tgt.x, p_tgt.y, p_tgt.z);
1274 vtkNew<vtkLine> line;
1275 line->GetPointIds()->SetId(0, id1);
1276 line->GetPointIds()->SetId(1, id2);
1277 line_cells->InsertNextCell(line);
1280 rgb[0] = vtkMath::Random (32, 255);
1281 rgb[1] = vtkMath::Random (32, 255);
1282 rgb[2] = vtkMath::Random (32, 255);
1283 line_colors->InsertTuple (j, rgb);
1286 line_colors->SetNumberOfTuples (j);
1287 line_data->SetPoints (line_points);
1288 line_data->SetLines (line_cells);
1289 line_data->GetCellData ()->SetScalars (line_colors);
1291 line_points->SetNumberOfPoints (2 * n_corr);
1293 line_cells_id->SetNumberOfComponents (3);
1294 line_cells_id->SetNumberOfTuples (n_corr);
1295 vtkIdType *line_cell_id = line_cells_id->GetPointer (0);
1298 line_tcoords->SetNumberOfComponents (1);
1299 line_tcoords->SetNumberOfTuples (n_corr * 2);
1300 line_tcoords->SetName (
"Texture Coordinates");
1302 double tc[3] = {0.0, 0.0, 0.0};
1306 for (std::size_t i = 0; i < correspondences.size (); i += nth)
1308 if (correspondences[i].index_match ==
UNAVAILABLE)
1310 PCL_WARN (
"[addCorrespondences] No valid index_match for correspondence %d\n", i);
1314 PointT p_src ((*source_points)[correspondences[i].index_query]);
1315 PointT p_tgt ((*target_points)[correspondences[i].index_match]);
1317 p_src.getVector3fMap () = source_transformation * p_src.getVector3fMap ();
1318 p_tgt.getVector3fMap () = target_transformation * p_tgt.getVector3fMap ();
1320 int id1 = j * 2 + 0, id2 = j * 2 + 1;
1322 line_points->SetPoint (id1, p_src.x, p_src.y, p_src.z);
1323 line_points->SetPoint (id2, p_tgt.x, p_tgt.y, p_tgt.z);
1325 *line_cell_id++ = 2;
1326 *line_cell_id++ = id1;
1327 *line_cell_id++ = id2;
1329 tc[0] = 0.; line_tcoords->SetTuple (id1, tc);
1330 tc[0] = 1.; line_tcoords->SetTuple (id2, tc);
1333 rgb[0] = vtkMath::Random (32, 255);
1334 rgb[1] = vtkMath::Random (32, 255);
1335 rgb[2] = vtkMath::Random (32, 255);
1336 line_colors->InsertTuple (j, rgb);
1339 line_colors->SetNumberOfTuples (j);
1340 line_cells_id->SetNumberOfTuples (j);
1341 line_cells->SetCells (j, line_cells_id);
1342 line_points->SetNumberOfPoints (j*2);
1343 line_tcoords->SetNumberOfTuples (j*2);
1346 line_data->SetPoints (line_points);
1347 line_data->SetLines (line_cells);
1348 line_data->GetPointData ()->SetTCoords (line_tcoords);
1349 line_data->GetCellData ()->SetScalars (line_colors);
1356 createActorFromVTKDataSet (line_data, actor);
1357 actor->GetProperty ()->SetRepresentationToWireframe ();
1358 actor->GetProperty ()->SetOpacity (0.5);
1359 addActorToRenderer (actor, viewport);
1362 (*shape_actor_map_)[id] = actor;
1370 reinterpret_cast<vtkPolyDataMapper*
> (actor->GetMapper ())->SetInputData (line_data);
1377template <
typename Po
intT>
bool
1383 const std::string &
id,
1386 return (addCorrespondences<PointT> (source_points, target_points, correspondences, nth,
id, viewport,
true));
1390template <
typename Po
intT>
bool
1391pcl::visualization::PCLVisualizer::fromHandlersToScreen (
1394 const std::string &
id,
1396 const Eigen::Vector4f& sensor_origin,
1397 const Eigen::Quaternion<float>& sensor_orientation)
1401 PCL_WARN (
"[fromHandlersToScreen] PointCloud <%s> requested with an invalid geometry handler (%s)!\n",
id.c_str (), geometry_handler.
getName ().c_str ());
1407 PCL_WARN (
"[fromHandlersToScreen] PointCloud <%s> requested with an invalid color handler (%s)!\n",
id.c_str (), color_handler.
getName ().c_str ());
1414 convertPointCloudToVTKPolyData<PointT> (geometry_handler, polydata, initcells);
1417 bool has_colors =
false;
1419 if (
auto scalars = color_handler.
getColor ())
1421 polydata->GetPointData ()->SetScalars (scalars);
1422 scalars->GetRange (minmax);
1428 createActorFromVTKDataSet (polydata, actor);
1430 actor->GetMapper ()->SetScalarRange (minmax);
1433 addActorToRenderer (actor, viewport);
1436 CloudActor& cloud_actor = (*cloud_actor_map_)[id];
1437 cloud_actor.actor = actor;
1438 cloud_actor.cells = initcells;
1442 convertToVtkMatrix (sensor_origin, sensor_orientation, transformation);
1443 cloud_actor.viewpoint_transformation_ = transformation;
1444 cloud_actor.actor->SetUserMatrix (transformation);
1445 cloud_actor.actor->Modified ();
1451template <
typename Po
intT>
bool
1452pcl::visualization::PCLVisualizer::fromHandlersToScreen (
1453 const PointCloudGeometryHandler<PointT> &geometry_handler,
1454 const ColorHandlerConstPtr &color_handler,
1455 const std::string &
id,
1457 const Eigen::Vector4f& sensor_origin,
1458 const Eigen::Quaternion<float>& sensor_orientation)
1460 if (!geometry_handler.isCapable ())
1462 PCL_WARN (
"[fromHandlersToScreen] PointCloud <%s> requested with an invalid geometry handler (%s)!\n",
id.c_str (), geometry_handler.getName ().c_str ());
1466 if (!color_handler->isCapable ())
1468 PCL_WARN (
"[fromHandlersToScreen] PointCloud <%s> requested with an invalid color handler (%s)!\n",
id.c_str (), color_handler->getName ().c_str ());
1475 convertPointCloudToVTKPolyData<PointT> (geometry_handler, polydata, initcells);
1479 bool has_colors =
false;
1481 if (
auto scalars = color_handler->getColor ())
1483 polydata->GetPointData ()->SetScalars (scalars);
1484 scalars->GetRange (minmax);
1490 createActorFromVTKDataSet (polydata, actor);
1492 actor->GetMapper ()->SetScalarRange (minmax);
1495 addActorToRenderer (actor, viewport);
1498 CloudActor& cloud_actor = (*cloud_actor_map_)[id];
1499 cloud_actor.actor = actor;
1500 cloud_actor.cells = initcells;
1501 cloud_actor.color_handlers.push_back (color_handler);
1505 convertToVtkMatrix (sensor_origin, sensor_orientation, transformation);
1506 cloud_actor.viewpoint_transformation_ = transformation;
1507 cloud_actor.actor->SetUserMatrix (transformation);
1508 cloud_actor.actor->Modified ();
1514template <
typename Po
intT>
bool
1515pcl::visualization::PCLVisualizer::fromHandlersToScreen (
1516 const GeometryHandlerConstPtr &geometry_handler,
1517 const PointCloudColorHandler<PointT> &color_handler,
1518 const std::string &
id,
1520 const Eigen::Vector4f& sensor_origin,
1521 const Eigen::Quaternion<float>& sensor_orientation)
1523 if (!geometry_handler->isCapable ())
1525 PCL_WARN (
"[fromHandlersToScreen] PointCloud <%s> requested with an invalid geometry handler (%s)!\n",
id.c_str (), geometry_handler->getName ().c_str ());
1529 if (!color_handler.isCapable ())
1531 PCL_WARN (
"[fromHandlersToScreen] PointCloud <%s> requested with an invalid color handler (%s)!\n",
id.c_str (), color_handler.getName ().c_str ());
1538 convertPointCloudToVTKPolyData (geometry_handler, polydata, initcells);
1542 bool has_colors =
false;
1544 if (
auto scalars = color_handler.getColor ())
1546 polydata->GetPointData ()->SetScalars (scalars);
1547 scalars->GetRange (minmax);
1553 createActorFromVTKDataSet (polydata, actor);
1555 actor->GetMapper ()->SetScalarRange (minmax);
1558 addActorToRenderer (actor, viewport);
1561 CloudActor& cloud_actor = (*cloud_actor_map_)[id];
1562 cloud_actor.actor = actor;
1563 cloud_actor.cells = initcells;
1564 cloud_actor.geometry_handlers.push_back (geometry_handler);
1568 convertToVtkMatrix (sensor_origin, sensor_orientation, transformation);
1569 cloud_actor.viewpoint_transformation_ = transformation;
1570 cloud_actor.actor->SetUserMatrix (transformation);
1571 cloud_actor.actor->Modified ();
1577template <
typename Po
intT>
bool
1579 const std::string &
id)
1582 auto am_it = cloud_actor_map_->find (
id);
1584 if (am_it == cloud_actor_map_->end ())
1591 convertPointCloudToVTKPolyData<PointT> (cloud, polydata, am_it->second.cells);
1595 polydata->GetPointData ()->SetScalars (scalars);
1597 minmax[0] = std::numeric_limits<double>::min ();
1598 minmax[1] = std::numeric_limits<double>::max ();
1599 am_it->second.actor->GetMapper ()->SetScalarRange (minmax);
1602 reinterpret_cast<vtkPolyDataMapper*
> (am_it->second.actor->GetMapper ())->SetInputData (polydata);
1607template <
typename Po
intT>
bool
1610 const std::string &
id)
1613 auto am_it = cloud_actor_map_->find (
id);
1615 if (am_it == cloud_actor_map_->end ())
1622 convertPointCloudToVTKPolyData (geometry_handler, polydata, am_it->second.cells);
1626 polydata->GetPointData ()->SetScalars (scalars);
1628 minmax[0] = std::numeric_limits<double>::min ();
1629 minmax[1] = std::numeric_limits<double>::max ();
1630 am_it->second.actor->GetMapper ()->SetScalarRange (minmax);
1633 reinterpret_cast<vtkPolyDataMapper*
> (am_it->second.actor->GetMapper ())->SetInputData (polydata);
1639template <
typename Po
intT>
bool
1642 const std::string &
id)
1645 auto am_it = cloud_actor_map_->find (
id);
1647 if (am_it == cloud_actor_map_->end ())
1655 convertPointCloudToVTKPolyData<PointT>(cloud, polydata, am_it->second.cells);
1658 bool has_colors =
false;
1660 if (
auto scalars = color_handler.
getColor ())
1663 polydata->GetPointData ()->SetScalars (scalars);
1664 scalars->GetRange (minmax);
1669 am_it->second.actor->GetMapper ()->SetScalarRange (minmax);
1672 reinterpret_cast<vtkPolyDataMapper*
> (am_it->second.actor->GetMapper ())->SetInputData (polydata);
1677template <
typename Po
intT>
bool
1680 const std::vector<pcl::Vertices> &vertices,
1681 const std::string &
id,
1684 if (vertices.empty () || cloud->
points.empty ())
1689 PCL_WARN (
"[addPolygonMesh] The id <%s> already exists! Please choose a different id and retry.\n",
id.c_str ());
1694 std::vector<pcl::PCLPointField> fields;
1696 rgb_idx = pcl::getFieldIndex<PointT> (
"rgb", fields);
1698 rgb_idx = pcl::getFieldIndex<PointT> (
"rgba", fields);
1702 colors->SetNumberOfComponents (3);
1703 colors->SetName (
"Colors");
1704 std::uint32_t offset = fields[rgb_idx].offset;
1705 for (std::size_t i = 0; i < cloud->
size (); ++i)
1709 const auto*
const rgb_data =
reinterpret_cast<const pcl::RGB*
>(
reinterpret_cast<const char*
> (&(*cloud)[i]) + offset);
1710 unsigned char color[3];
1711 color[0] = rgb_data->r;
1712 color[1] = rgb_data->g;
1713 color[2] = rgb_data->b;
1714 colors->InsertNextTupleValue (color);
1720 vtkIdType nr_points = cloud->
size ();
1721 points->SetNumberOfPoints (nr_points);
1725 float *data =
dynamic_cast<vtkFloatArray*
> (points->GetData ())->GetPointer (0);
1728 std::vector<int> lookup;
1732 for (vtkIdType i = 0; i < nr_points; ++i, ptr += 3) {
1733 std::copy(&(*cloud)[i].x, &(*cloud)[i].x + 3, &data[ptr]);
1738 lookup.resize (nr_points);
1740 for (vtkIdType i = 0; i < nr_points; ++i)
1746 lookup[i] =
static_cast<int> (j);
1747 std::copy (&(*cloud)[i].x, &(*cloud)[i].x + 3, &data[ptr]);
1752 points->SetNumberOfPoints (nr_points);
1756 int max_size_of_polygon = -1;
1757 for (
const auto &vertex : vertices)
1758 if (max_size_of_polygon <
static_cast<int> (vertex.vertices.size ()))
1759 max_size_of_polygon =
static_cast<int> (vertex.vertices.size ());
1761 if (vertices.size () > 1)
1769 allocVtkPolyData (polydata);
1770 cell_array->Squeeze ();
1771 polydata->SetPolys (cell_array);
1772 polydata->SetPoints (points);
1775 polydata->GetPointData ()->SetScalars (colors);
1777 createActorFromVTKDataSet (polydata, actor,
false);
1782 std::size_t n_points = vertices[0].vertices.size ();
1783 polygon->GetPointIds ()->SetNumberOfIds (n_points - 1);
1785 if (!lookup.empty ())
1787 for (std::size_t j = 0; j < (n_points - 1); ++j)
1788 polygon->GetPointIds ()->SetId (j, lookup[vertices[0].vertices[j]]);
1792 for (std::size_t j = 0; j < (n_points - 1); ++j)
1793 polygon->GetPointIds ()->SetId (j, vertices[0].vertices[j]);
1797 poly_grid->Allocate (1, 1);
1798 poly_grid->InsertNextCell (polygon->GetCellType (), polygon->GetPointIds ());
1799 poly_grid->SetPoints (points);
1801 poly_grid->GetPointData ()->SetScalars (colors);
1803 createActorFromVTKDataSet (poly_grid, actor,
false);
1805 addActorToRenderer (actor, viewport);
1806 actor->GetProperty ()->SetRepresentationToSurface ();
1808 actor->GetProperty ()->BackfaceCullingOff ();
1809 actor->GetProperty ()->SetInterpolationToFlat ();
1810 actor->GetProperty ()->EdgeVisibilityOff ();
1811 actor->GetProperty ()->ShadingOff ();
1814 (*cloud_actor_map_)[id].actor = actor;
1819 (*cloud_actor_map_)[id].viewpoint_transformation_ = transformation;
1825template <
typename Po
intT>
bool
1828 const std::vector<pcl::Vertices> &verts,
1829 const std::string &
id)
1838 auto am_it = cloud_actor_map_->find (
id);
1839 if (am_it == cloud_actor_map_->end ())
1851 vtkIdType nr_points = cloud->
size ();
1852 points->SetNumberOfPoints (nr_points);
1855 float *data = (
dynamic_cast<vtkFloatArray*
> (points->GetData ()))->GetPointer (0);
1858 std::vector<int> lookup;
1862 for (vtkIdType i = 0; i < nr_points; ++i, ptr += 3)
1863 std::copy (&(*cloud)[i].x, &(*cloud)[i].x + 3, &data[ptr]);
1867 lookup.resize (nr_points);
1869 for (vtkIdType i = 0; i < nr_points; ++i)
1875 lookup [i] =
static_cast<int> (j);
1876 std::copy (&(*cloud)[i].x, &(*cloud)[i].x + 3, &data[ptr]);
1881 points->SetNumberOfPoints (nr_points);
1885 vtkUnsignedCharArray* colors = vtkUnsignedCharArray::SafeDownCast (polydata->GetPointData ()->GetScalars ());
1889 std::vector<pcl::PCLPointField> fields;
1890 rgb_idx = pcl::getFieldIndex<PointT> (
"rgb", fields);
1892 rgb_idx = pcl::getFieldIndex<PointT> (
"rgba", fields);
1893 if (rgb_idx != -1 && colors)
1896 std::uint32_t offset = fields[rgb_idx].offset;
1897 for (std::size_t i = 0; i < cloud->
size (); ++i)
1901 const auto*
const rgb_data =
reinterpret_cast<const pcl::RGB*
>(
reinterpret_cast<const char*
> (&(*cloud)[i]) + offset);
1902 unsigned char color[3];
1903 color[0] = rgb_data->r;
1904 color[1] = rgb_data->g;
1905 color[2] = rgb_data->b;
1906 colors->SetTupleValue (j++, color);
1911 int max_size_of_polygon = -1;
1912 for (
const auto &vertex : verts)
1913 if (max_size_of_polygon <
static_cast<int> (vertex.vertices.size ()))
1914 max_size_of_polygon =
static_cast<int> (vertex.vertices.size ());
1923 polydata->SetPolys (cells);
1928#ifdef vtkGenericDataArray_h
1930#undef InsertNextTupleValue
PlanarPolygon represents a planar (2D) polygon, potentially in a 3D space.
bool is_dense
True if no points are invalid (e.g., have NaN or Inf values in any of their floating point fields).
Eigen::Quaternionf sensor_orientation_
Sensor acquisition pose (rotation).
std::uint32_t width
The point cloud width (if organized as an image-structure).
bool isOrganized() const
Return whether a dataset is organized (e.g., arranged in a structured grid).
std::uint32_t height
The point cloud height (if organized as an image-structure).
Eigen::Vector4f sensor_origin_
Sensor acquisition pose (origin/translation).
std::vector< PointT, Eigen::aligned_allocator< PointT > > points
The point data.
shared_ptr< const PointCloud< PointT > > ConstPtr
vtkSmartPointer< vtkLODActor > actor
The actor holding the data to render.
bool addPointCloudIntensityGradients(const typename pcl::PointCloud< PointT >::ConstPtr &cloud, const typename pcl::PointCloud< GradientT >::ConstPtr &gradients, int level=100, double scale=1e-6, const std::string &id="cloud", int viewport=0)
Add the estimated surface intensity gradients of a Point Cloud to screen.
bool addPolygonMesh(const pcl::PolygonMesh &polymesh, const std::string &id="polygon", int viewport=0)
Add a PolygonMesh object to screen.
bool addSphere(const PointT ¢er, double radius, const std::string &id="sphere", int viewport=0)
Add a sphere shape from a point and a radius.
bool addPointCloud(const typename pcl::PointCloud< PointT >::ConstPtr &cloud, const std::string &id="cloud", int viewport=0)
Add a Point Cloud (templated) to screen.
bool addCorrespondences(const typename pcl::PointCloud< PointT >::ConstPtr &source_points, const typename pcl::PointCloud< PointT >::ConstPtr &target_points, const std::vector< int > &correspondences, const std::string &id="correspondences", int viewport=0)
Add the specified correspondences to the display.
bool addPolygon(const typename pcl::PointCloud< PointT >::ConstPtr &cloud, double r, double g, double b, const std::string &id="polygon", int viewport=0)
Add a polygon (polyline) that represents the input point cloud (connects all points in order)
bool updatePointCloud(const typename pcl::PointCloud< PointT >::ConstPtr &cloud, const std::string &id="cloud")
Updates the XYZ data for an existing cloud object id on screen.
GeometryHandler::ConstPtr GeometryHandlerConstPtr
bool addPointCloudNormals(const typename pcl::PointCloud< PointNT >::ConstPtr &cloud, int level=100, float scale=0.02f, const std::string &id="cloud", int viewport=0)
Add the estimated surface normals of a Point Cloud to screen.
bool addText3D(const std::string &text, const PointT &position, double textScale=1.0, double r=1.0, double g=1.0, double b=1.0, const std::string &id="", int viewport=0)
Add a 3d text to the scene.
bool updateSphere(const PointT ¢er, double radius, double r, double g, double b, const std::string &id="sphere")
Update an existing sphere shape from a point and a radius.
ColorHandler::ConstPtr ColorHandlerConstPtr
bool addArrow(const P1 &pt1, const P2 &pt2, double r, double g, double b, const std::string &id="arrow", int viewport=0)
Add a line arrow segment between two points, and display the distance between them.
bool addLine(const P1 &pt1, const P2 &pt2, const std::string &id="line", int viewport=0)
Add a line segment from two points.
bool addPointCloudPrincipalCurvatures(const typename pcl::PointCloud< PointNT >::ConstPtr &cloud, const typename pcl::PointCloud< pcl::PrincipalCurvatures >::ConstPtr &pcs, int level=100, float scale=1.0f, const std::string &id="cloud", int viewport=0)
Add the estimated principal curvatures of a Point Cloud to screen.
bool updatePolygonMesh(const typename pcl::PointCloud< PointT >::ConstPtr &cloud, const std::vector< pcl::Vertices > &vertices, const std::string &id="polygon")
Update a PolygonMesh object on screen.
bool updateCorrespondences(const typename pcl::PointCloud< PointT >::ConstPtr &source_points, const typename pcl::PointCloud< PointT >::ConstPtr &target_points, const pcl::Correspondences &correspondences, int nth, const std::string &id="correspondences", int viewport=0)
Update the specified correspondences to the display.
Handler for predefined user colors.
Base Handler class for PointCloud colors.
virtual vtkSmartPointer< vtkDataArray > getColor() const =0
Obtain the actual color for the input dataset as a VTK data array.
bool isCapable() const
Check if this handler is capable of handling the input data or not.
virtual std::string getName() const =0
Abstract getName method.
RGB handler class for colors.
Base handler class for PointCloud geometry.
virtual std::string getName() const =0
Abstract getName method.
bool isCapable() const
Check if this handler is capable of handling the input data or not.
virtual void getGeometry(vtkSmartPointer< vtkPoints > &points) const =0
Obtain the actual point geometry for the input dataset in VTK format.
XYZ handler class for PointCloud geometry.
PCL_EXPORTS vtkSmartPointer< vtkDataSet > createLine(const Eigen::Vector4f &pt1, const Eigen::Vector4f &pt2)
Create a line shape from two points.
PCL_EXPORTS void print_error(FILE *stream, const std::string format, Args &&... args)
Print an error message on stream with colors.
void ignore(const T &...)
Utility function to eliminate unused variable warnings.
PCL_EXPORTS vtkIdType fillCells(std::vector< int > &lookup, const std::vector< pcl::Vertices > &vertices, vtkSmartPointer< vtkCellArray > cell_array, int max_size_of_polygon)
PCL_EXPORTS void allocVtkUnstructuredGrid(vtkSmartPointer< vtkUnstructuredGrid > &polydata)
Allocate a new unstructured grid smartpointer.
bool isFinite(const PointT &pt)
Tests if the 3D components of a point are all finite param[in] pt point to be tested return true if f...
static constexpr index_t UNAVAILABLE
std::vector< pcl::Correspondence, Eigen::aligned_allocator< pcl::Correspondence > > Correspondences
constexpr bool isNormalFinite(const PointT &) noexcept
constexpr bool isXYZFinite(const PointT &) noexcept
Define methods or creating 3D shapes from parametric models.
A point structure representing Euclidean xyz coordinates, and the RGB color.
A structure representing RGB color information.
Metafunction to check if a given point type has either rgb or rgba field.