main (int, char**)
//define the cloud type
typedef pcl::PointCloud<pcl::PointXYZ> CloudType;
//declare a pointer of pointcloud and initialize it using new
CloudType::Ptr cloud (new CloudType);
//set the member of point cloud dense to be false
cloud->is_dense = false;
//create another point cloud
CloudType::Ptr output_cloud (new CloudType);
//Create a point type and initialize it with nan
p_nan.x = std::numeric_limits<float>::quiet_NaN();
p_nan.y = std::numeric_limits<float>::quiet_NaN();
p_nan.z = std::numeric_limits<float>::quiet_NaN();
//load the pointtype in pointcloud - cloud
//Create a valid point type and push that also in cloud
p_valid.x = 1.0f;
Will leave the surface cloud untouched and the vector of indices as long as the number of points in the cloud.
It just simply means that you have no NaNs in your cloud. If you are not convinced, manually go through each point of your cloud in a for loop and count how many times !pcl_isfinite (surface->points[i].x/y/z) is true.
Also, the indices returned are in a std::vector<int>, all PCL methods however require indices to be passed as a special PCL type, why the inconsistency?
The "special" PCL structure your are talking about is a pcl::IndicesPtr which is simply a typedef for boost::shared_ptr<std::vector<int> >. The documentation is your friend. :-)
that is correct, after using the function removeNaNFromPointCloud the pc is not organize anymore.
You can not retain the structure using the above mentioned function, since the points are removed from the pc. If you need to retain the structure, iterate over the point cloud and check for NaN's, only process the points which are valid.