39 #ifndef PCL_POINT_CLOUD_GEOMETRY_HANDLERS_IMPL_HPP_
40 #define PCL_POINT_CLOUD_GEOMETRY_HANDLERS_IMPL_HPP_
42 #include <pcl/pcl_macros.h>
45 template <
typename Po
intT>
62 template <
typename Po
intT>
void
70 points->SetDataTypeToFloat ();
73 data->SetNumberOfComponents (3);
74 vtkIdType nr_points = cloud_->points.size ();
78 float* pts =
static_cast<float*
> (malloc (nr_points * 3 *
sizeof (
float)));
83 for (vtkIdType i = 0; i < nr_points; ++i)
85 pts[i * 3 + 0] = cloud_->points[i].x;
86 pts[i * 3 + 1] = cloud_->points[i].y;
87 pts[i * 3 + 2] = cloud_->points[i].z;
89 data->SetArray (&pts[0], nr_points * 3, 0);
90 points->SetData (data);
95 for (vtkIdType i = 0; i < nr_points; ++i)
98 if (!pcl_isfinite (cloud_->points[i].x) || !pcl_isfinite (cloud_->points[i].y) || !pcl_isfinite (cloud_->points[i].z))
101 pts[j * 3 + 0] = cloud_->points[i].x;
102 pts[j * 3 + 1] = cloud_->points[i].y;
103 pts[j * 3 + 2] = cloud_->points[i].z;
107 data->SetArray (&pts[0], j * 3, 0);
108 points->SetData (data);
113 template <
typename Po
intT>
130 template <
typename Po
intT>
void
138 points->SetDataTypeToFloat ();
139 points->SetNumberOfPoints (cloud_->points.size ());
143 for (vtkIdType i = 0; i < static_cast<vtkIdType> (cloud_->points.size ()); ++i)
145 p[0] = cloud_->points[i].normal[0];
146 p[1] = cloud_->points[i].normal[1];
147 p[2] = cloud_->points[i].normal[2];
149 points->SetPoint (i, p);
153 #define PCL_INSTANTIATE_PointCloudGeometryHandlerXYZ(T) template class PCL_EXPORTS pcl::visualization::PointCloudGeometryHandlerXYZ<T>;
154 #define PCL_INSTANTIATE_PointCloudGeometryHandlerSurfaceNormal(T) template class PCL_EXPORTS pcl::visualization::PointCloudGeometryHandlerSurfaceNormal<T>;
156 #endif // PCL_POINT_CLOUD_GEOMETRY_HANDLERS_IMPL_HPP_
PointCloud::ConstPtr PointCloudConstPtr
int field_x_idx_
The index of the field holding the X data.
int field_z_idx_
The index of the field holding the Z data.
PointCloudGeometryHandlerSurfaceNormal(const PointCloudConstPtr &cloud)
Constructor.
int getFieldIndex(const pcl::PCLPointCloud2 &cloud, const std::string &field_name)
Get the index of a specified field (i.e., dimension/channel)
virtual void getGeometry(vtkSmartPointer< vtkPoints > &points) const
Obtain the actual point geometry for the input dataset in VTK format.
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.
PointCloudGeometryHandlerXYZ(const PointCloudConstPtr &cloud)
Constructor.
int field_y_idx_
The index of the field holding the Y data.
Base handler class for PointCloud geometry.
std::vector< pcl::PCLPointField > fields_
The list of fields available for this PointCloud.
A point structure representing Euclidean xyz coordinates, and the RGB color.