Home > front end >  How to clear VTK points
How to clear VTK points

Time:02-20

I am new to vtk and I am writing an app to draw multiple shapes. The shapes are drawn using point picking event as follow:

void Visualizer::pointPickingEventOccurred (const pcl::visualization::PointPickingEvent &event)
 {
    std::cout << "[INOF] Point picking event occurred." << std::endl;

      float x, y, z;
      if (event.getPointIndex () == -1)
      {
         return;
      }
      event.getPoint(x, y, z);
      std::cout << "[INOF] Point coordinate ( " << x << ", " << y << ", " << z << ")" << std::endl;
      
      points->InsertNextPoint(x, y, z);


 }

points here is a vtk point list:

vtkNew<vtkPoints> points;

I am trying to clear points so I can resize it and get new points for each shape but I have not found a way to clear the list.

CodePudding user response:

A simple call to points->Reset() will do the trick. It will make the object look empty without actually releasing the memory.

CodePudding user response:

Dose Initialize () do the tricky?

  • Related