I would like to know if VTK can load a PLY file of the following format.
File header)
ply
format binary_little_endian 1.0
comment Zivid Point Cloud
element vertex 2304000
property float x
property float y
property float z
property uchar red
property uchar green
property uchar blue
end_header
Code)
vtkSmartPointer reader = vtkSmartPointer::New();
reader->SetFileName(file_path.c_str());
char* c = reader->GetFileName();
// Visualize
vtkSmartPointer<vtkPolyDataMapper> mapper = vtkSmartPointer<vtkPolyDataMapper>::New();
mapper->SetInputConnection(reader->GetOutputPort(0));
vtkSmartPointer<vtkActor> actor = vtkSmartPointer<vtkActor>::New();
actor->SetMapper(mapper);
vtkSmartPointer<vtkRenderer> renderer = vtkSmartPointer<vtkRenderer>::New();
vtkSmartPointer<vtkRenderWindow> renderWindow = vtkSmartPointer<vtkRenderWindow>::New();
renderWindow->AddRenderer(renderer);
vtkSmartPointer<vtkRenderWindowInteractor> renderWindowInteractor = vtkSmartPointer<vtkRenderWindowInteractor>::New();
renderWindowInteractor->SetRenderWindow(renderWindow);
renderer->AddActor(actor);
renderer->SetBackground(0.1804, 0.5451, 0.3412); // Sea green
renderWindow->Render();
renderWindowInteractor->Start();