[vtkusers] Problem with vtkContourFilter with unstructured grid

ZACK chihebz at hotmail.com
Fri Mar 30 16:45:32 EDT 2018


Hi Luca,

I have an unstructured grid and When I create the vtkContourFilter I do the
following and it works for me


// convert from unstructuredGrid to PolyData
	vtkSmartPointer<vtkGeometryFilter> extract =
vtkSmartPointer<vtkGeometryFilter>::New();
	extract->SetInputConnection(c2p->GetOutputPort());
	extract->Modified();

// CONTOUR FILTER
vtkSmartPointer<vtkContourFilter> contourFilter = 
vtkSmartPointer<vtkContourFilter>::New();
contourFilter->SetInputConnection(extract->GetOutputPort());

//get unstructured grid values range
double* pRange = new double[2];
c2p->GetScalarRange(pRange);

contourFilter->GenerateValues(10, pRange);
contourFilter->Modified();

// VISUALIZATION

vtkSmartPointer<vtkActor> contourActor {vtkSmartPointer<vtkActor>::New()};
contourActor->SetMapper(contourMapper);

vtkSmartPointer<vtkRenderer> renderer {vtkSmartPointer<vtkRenderer>::New()};
contourActor->SetMapper(contourMapper);

renderer->AddActor(contourActor);

Regards





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


More information about the vtkusers mailing list