[vtkusers] Dynamically Add and Render Points using vtkPolyData

Andrew Andrew at Ryonic.io
Thu Oct 19 01:30:26 EDT 2017

Hi All, 

This will be my first post, I am new to VTK so I apologize for any Noobie

Outline: Our project uses a 2D lidar on a Robot to profile areas as it
moves, we are currently using VTK to visualize these point clouds. 

The application needs to be real time as such we receive 10 scans a second
with roughly 360 points per scan. 

What is the best way to add points to PolyData and render it? 

The current method adds these points to the Polydata via: 
lidar_points = gcnew vtkPoints(); 
lidar_points_colors = gcnew vtkUnsignedCharArray(); 
vertices = gcnew vtkCellArray(); 

//Per scan 
for (point p in scan) 
   vtkPointData^ newPoint = vtkPointData::New(); 
   int Id = lidar_points->InsertNextPoint(new_lidar_point_x,
new_lidar_point_y, new_lidar_point_z); 


I have checked and the Insert for each scan takes 3ms regardless of total
point size of PolyData. 
But the Render(); method starts at 4-5ms for an empty set and quickly grows
to 150ms for 1 million points. which already slows down the 10Hz scan rate. 

Interestingly when the scans stop, using the mouse to interact with the
scene gives a very good FPS even when there are 3 Million points 

The system has a GPU and I can verify the render calls do use the GPU, using
the mouse with 3 Million points maxes the GPU (100% utilization). 

While Points are added and rendered both the GPU and CPU of the system are
below 50%, I have tried using threads to Split adding points from the render
event but Vtk really didnt enjoy that :P 

Any Feed back would be very helpful

Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html

More information about the vtkusers mailing list