40 #ifndef PCL_POINT_CLOUD_GEOMETRY_HANDLERS_IMPL_HPP_
41 #define PCL_POINT_CLOUD_GEOMETRY_HANDLERS_IMPL_HPP_
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_->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_)[i].x;
93 pts[i * 3 + 1] = (*cloud_)[i].y;
94 pts[i * 3 + 2] = (*cloud_)[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_)[i].x) || !std::isfinite ((*cloud_)[i].y) || !std::isfinite ((*cloud_)[i].z))
108 pts[j * 3 + 0] = (*cloud_)[i].x;
109 pts[j * 3 + 1] = (*cloud_)[i].y;
110 pts[j * 3 + 2] = (*cloud_)[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_->size ());
150 for (vtkIdType i = 0; i < static_cast<vtkIdType> (cloud_->size ()); ++i)
152 p[0] = (*cloud_)[i].normal[0];
153 p[1] = (*cloud_)[i].normal[1];
154 p[2] = (*cloud_)[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>;
Base handler class for PointCloud geometry.
std::vector< pcl::PCLPointField > fields_
The list of fields available for this PointCloud.
index_t field_y_idx_
The index of the field holding the Y data.
index_t field_z_idx_
The index of the field holding the Z data.
bool capable_
True if this handler is capable of handling the input data, false otherwise.
typename PointCloud::ConstPtr PointCloudConstPtr
index_t field_x_idx_
The index of the field holding the X data.
virtual void getGeometry(vtkSmartPointer< vtkPoints > &points) const
Obtain the actual point geometry for the input dataset in VTK format.
PointCloudGeometryHandlerSurfaceNormal(const PointCloudConstPtr &cloud)
Constructor.
virtual void getGeometry(vtkSmartPointer< vtkPoints > &points) const
Obtain the actual point geometry for the input dataset in VTK format.
PointCloudGeometryHandlerXYZ(const PointCloudConstPtr &cloud)
Constructor.
static constexpr index_t UNAVAILABLE
Defines all the PCL and non-PCL macros used.
A point structure representing Euclidean xyz coordinates, and the RGB color.