40 #ifndef PCL_POINT_CLOUD_GEOMETRY_HANDLERS_IMPL_HPP_
41 #define PCL_POINT_CLOUD_GEOMETRY_HANDLERS_IMPL_HPP_
43 #include <pcl/pcl_macros.h>
49 namespace visualization
52 template <
typename Po
intT>
69 template <
typename Po
intT>
void
77 points->SetDataTypeToFloat ();
80 data->SetNumberOfComponents (3);
81 vtkIdType nr_points = cloud_->points.size ();
85 float* pts =
static_cast<float*
> (malloc (nr_points * 3 *
sizeof (
float)));
90 for (vtkIdType i = 0; i < nr_points; ++i)
92 pts[i * 3 + 0] = cloud_->points[i].x;
93 pts[i * 3 + 1] = cloud_->points[i].y;
94 pts[i * 3 + 2] = cloud_->points[i].z;
96 data->SetArray (&pts[0], nr_points * 3, 0);
97 points->SetData (data);
102 for (vtkIdType i = 0; i < nr_points; ++i)
105 if (!std::isfinite (cloud_->points[i].x) || !std::isfinite (cloud_->points[i].y) || !std::isfinite (cloud_->points[i].z))
108 pts[j * 3 + 0] = cloud_->points[i].x;
109 pts[j * 3 + 1] = cloud_->points[i].y;
110 pts[j * 3 + 2] = cloud_->points[i].z;
114 data->SetArray (&pts[0], j * 3, 0);
115 points->SetData (data);
120 template <
typename Po
intT>
137 template <
typename Po
intT>
void
145 points->SetDataTypeToFloat ();
146 points->SetNumberOfPoints (cloud_->points.size ());
150 for (vtkIdType i = 0; i < static_cast<vtkIdType> (cloud_->points.size ()); ++i)
152 p[0] = cloud_->points[i].normal[0];
153 p[1] = cloud_->points[i].normal[1];
154 p[2] = cloud_->points[i].normal[2];
156 points->SetPoint (i, p);
163 #define PCL_INSTANTIATE_PointCloudGeometryHandlerXYZ(T) template class PCL_EXPORTS pcl::visualization::PointCloudGeometryHandlerXYZ<T>;
164 #define PCL_INSTANTIATE_PointCloudGeometryHandlerSurfaceNormal(T) template class PCL_EXPORTS pcl::visualization::PointCloudGeometryHandlerSurfaceNormal<T>;
166 #endif // PCL_POINT_CLOUD_GEOMETRY_HANDLERS_IMPL_HPP_
PointCloudGeometryHandlerXYZ(const PointCloudConstPtr &cloud)
Constructor.
virtual void getGeometry(vtkSmartPointer< vtkPoints > &points) const
Obtain the actual point geometry for the input dataset in VTK format.
typename PointCloud::ConstPtr PointCloudConstPtr
PointCloudGeometryHandlerSurfaceNormal(const PointCloudConstPtr &cloud)
Constructor.
int field_y_idx_
The index of the field holding the Y data.
int field_z_idx_
The index of the field holding the Z data.
Base handler class for PointCloud geometry.
A point structure representing Euclidean xyz coordinates, and the RGB color.
std::vector< pcl::PCLPointField > fields_
The list of fields available for this PointCloud.
int field_x_idx_
The index of the field holding the X data.
bool capable_
True if this handler is capable of handling the input data, false otherwise.
virtual void getGeometry(vtkSmartPointer< vtkPoints > &points) const
Obtain the actual point geometry for the input dataset in VTK format.