[vtkusers] vtkFeatureEdges, vtkUnstructuredGrid to vtkPolyData and their writers
David Doria
daviddoria+vtk at gmail.com
Fri Jan 15 15:04:48 EST 2010
On Fri, Jan 15, 2010 at 2:52 PM, <lynx.abraxas at freenet.de> wrote:
> On 15/01/10 17:56:42, Bryn Lloyd wrote:
>> Maybe I misunderstand you, but I think you simply need to extract the
>> triangle surface from the tetrahedral mesh (obtained with Delaunay3D).
>>
>> This will only leave the triangles, which are used by only one
>> tetrahedron, so only those on the surface.
>>
>>
>> Try vtkDataSetSurfaceFilter.
>
> Thanks, that's the one I was desperatly looking for. On the way I found
> vtkFeatureEdges. But appling that to the extracted edges
> (featureEdges->SetInput(edges->GetOutput())) resulted in an empty output.
> Appling it to the ouput of delaunay3D
> (featureEdges->SetInput(delaunay3D->GetOutput())) didn't work because its
> output is not vtkPolyData. I also tried this in paraview: my delaunay3D mesh
> is not accepted where as a tourus is. Why's that?
> How can one convert a vtkUnstructuredGrid to vtkPolyData? I tried to learn
> about the difference of these to from the vtk book but still I don't know.
> They both seem to support faces, edges and vertices.
>
> Also I noticed there is a vtkXMLDataSetWriter, vtkXMLPolyDataWriter and
> vtkXMLUnstructuredGridWriter. When to use which?
>
> Thanks guys for the big help. I'd be really stuck for ages without Your
> support!
> Lynx.
Lynx,
I started a brief summary of these data types here: (mainly taken from
the VTK book)
http://www.cmake.org/Wiki/VTK_3D_Data_Types#Structured_Grid
Please add to it as you find examples of each type or have better explanations.
vtkDelaunay3D definitely creates 3D cells (tetrahedra). That is why it
cannot be a PolyData, because polydata only accepts 0,1,2D cells. It
must be an unstructured grid (which also accepts 3D cells).
You should use vtkXMLPolyDataWriter for PolyData.
You should use vtkXMLUnstructuredGridWriter for UnstructuredGrid.
vtkXMLDataSetWriter is a wrapper around the VTK XML file format
writers. Given an input vtkDataSet, the correct writer is
automatically selected based on the type of input. (taken from the
documentation :) ) I was actually not aware of this writer, but it
seems extremely useful!
So to your main question - you can't directly convert from an
unstructured grid to a polydata because the unstructured grid can
contain elements that are not allowed in a polydata. You must use
either a filter that takes 3d cells as input and outputs only 2d cells
(such as vtkDataSetSurfaceFilter) or find some other way of getting
the things you need from the unstructured grid into the polydata (but
only things that are allowed in polydata!)
Hope that helps,
David
More information about the vtkusers
mailing list