[vtkusers] Iterate over disjoint surfaces of an unstructured grid

robert.sawko robertsawko at gmail.com
Sat Jan 20 04:50:48 EST 2018


Dear VTKiers,

I am pretty new to programming with VTK although I have worked indirectly
with it through ParaView. I am in process of learning some of the basics.
I'd like to check whether post-processing I am attempting is possible.

I have a collection of VTU/VTK files containing unstructured grids. They
represent 3D contour surfaces. I'd like to be able to iterate through all
the surfaces in a file, compute their area and if they're closed surfaces,
compute the volume enclosed.

I learnt that I can compute volume and surfaces through vtkMassProperties
object, but I tried this only on predefined sources e.g. cylinder or sphere.
I also learnt that I can open my files with vtkXMLUnstructuredGridReader.
Could anyone give me a hint on how to put the things together.

My objective is, I feel, on the border of VTK focus. It's not strictly
speaking visualisaiton, but post-processing.

Roughly speaking I'd like to have the following:

    vtkSmartPointer<vtkXMLUnstructuredGridReader> reader =
        vtkSmartPointer<vtkXMLUnstructuredGridReader>::New();
    reader->SetFileName(filename.c_str());

    for loop over all separate 3D contour surfaces
      if surface is closed:
        create vtkMassPropties and get volume

Sorry, this may still look pretty vague, but I would appreciate any advice.




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


More information about the vtkusers mailing list