Hi everyone .
I want to create an polydata like this
I created this Polydata
by this code :
auto appendPolyData = vtkSmartPointer<vtkAppendPolyData>::New();
for (const auto& slice : contour.Slices) {
auto points = vtkSmartPointer<vtkPoints>::New();
// Add points to vtkPoints
for (const auto& point : slice.Points) {
points->InsertNextPoint(point.X, point.Y, point.Z);
}
// Create a vtkPolyLine
auto polyLine = vtkSmartPointer<vtkPolyLine>::New();
polyLine->GetPointIds()->SetNumberOfIds(points->GetNumberOfPoints());
for (vtkIdType i = 0; i < points->GetNumberOfPoints(); i++) {
polyLine->GetPointIds()->SetId(i, i);
}
// Create a vtkCellArray to hold the polyline
auto cellArray = vtkSmartPointer<vtkCellArray>::New();
cellArray->InsertNextCell(polyLine);
// Create vtkPolyData to hold the geometry and topology
auto polyData = vtkSmartPointer<vtkPolyData>::New();
polyData->SetPoints(points);
polyData->SetLines(cellArray);
// Add the polyData to the append filter
appendPolyData->AddInputData(polyData);
}
appendPolyData->Update();
// Map the polyData to graphical primitives
auto mapper = vtkSmartPointer<vtkPolyDataMapper>::New();
mapper->SetInputData(appendPolyData->GetOutput());
// Create an actor
auto actor = vtkSmartPointer<vtkActor>::New();
actor->SetMapper(mapper);
actor->GetProperty()->SetColor(0, 0, 1); // Set actor color to blue
// Create a renderer and add the actor
auto renderer = vtkSmartPointer<vtkRenderer>::New();
renderer->AddActor(actor);
// Create a render window
auto renderWindow = vtkSmartPointer<vtkRenderWindow>::New();
renderWindow->AddRenderer(renderer);
// Create an interactor
auto interactor = vtkSmartPointer<vtkRenderWindowInteractor>::New();
interactor->SetRenderWindow(renderWindow);
// Render and start interaction
renderWindow->Render();
interactor->Start();
renderer->ResetCamera();
but between lines of slices are empty .
I tried vtkDelaunay3D but :
I also tried vtkDelaunay2D
But as you can see this need interpolation .
How Can do that?