Hello,
I’m reading an obj file “cube” which is a simple cube, and would like to project voronoi diagram on it.
I’ve tried the following code, but it either crashes, or it stays in infinite loop.
Kindly find the attached cube file also and sample code
vtkSmartPointer<vtkOBJReader> reader =
vtkSmartPointer<vtkOBJReader>::New();
reader->SetFileName("untitled.obj");
reader->Update();
cout << reader->GetOutput()->GetNumberOfPoints();
vornoi_2d = vtkSmartPointer<vtkVoronoi2D>::New();
vornoi_2d->SetInputData(reader->GetOutput());
vornoi_2d->SetGenerateScalarsToNone();
vornoi_2d->SetGenerateScalarsToPointIds();
vornoi_2d->SetPointOfInterest(-1);
vornoi_2d->SetMaximumNumberOfTileClips(50);
vornoi_2d->GetLocator()->SetNumberOfPointsPerBucket(15);
//vornoi_2d->SetGenerateVoronoiFlower(1);
vornoi_2d->Update();
vtkNew<vtkOBJWriter> plyWriter;
cout << vornoi_2d->GetOutput()->GetNumberOfPoints();
cout << vornoi_2d->GetOutput()->GetNumberOfCells();
plyWriter->SetFileName("final_vornoi.obj");
plyWriter->SetInputData(vornoi_2d->GetOutput());
plyWriter->Write();
untitled.obj (939 Bytes)