[vtkusers] Retrieve poligonal data after delaunay triangulation

Mike Jackson imikejackson at gmail.com
Wed May 16 07:59:34 EDT 2007


usually you hook up the output from a filter to the input of the next  
filter and it should just work. So in your case, you have an input  
vtkPolyData object and are feeding that into the DelauneyFilter and  
then want to write the results out to a file.

The following is some pseudo code but represents what should be done.

vtkPolyData* data;
vtkDelauneyFilter* filter = vtkDelauney::New();
filter->SetInput(data);
filter->Update(); //Forces updating of the pipeline.. Not really  
needed in some situations
vtkPolyDataWriter* writer = vtkPolyDataWriter::New();
writer->SetInputConnection( filter->GetOutputPort() );
writer->SetFileName( outputFile );
writer->Update();

writer->Delete()
filter->Delete()

Hope that helps.
-- 
Mike Jackson   Senior Research Engineer
Innovative Management & Technology Services


On May 16, 2007, at 6:42 AM, Samuel Marcos wrote:

> Ok, I've managed it (I write down the part of code in case someone  
> reads this post and needs it). The weird thing is that I previously  
> tried to write the PolyData to a text file. If I use the  
> vtkPolyDataWriter before extracting the triangles, I get an empty  
> array as if the vtkPolyDataWriter erased the PolyData. Is that  
> normal? I think this is a begginer question but how do I know if a  
> filter erases or changes the input contents? I've read each filter  
> makes a copy of the input so I thought the input would stay as it  
> is even if passed through a filter. Am I wrong? Many thanks to all  
> your responses, Luca, burlen and Mike (also for the code).
>
>   int j=0;
>     int h;
>     int npts=3,*pts;
>     vtkCellArray* oCellArr= vtkCellArray::New();
>     oCellArr=oPolyDataDel->GetPolys();
>      for(int i=0;i<oPolyDataDel->GetNumberOfPolys();i++)
>      {
>             h=oCellArr->GetNextCell(npts,pts);
>
>             if(h==0){
>                 break;
>             }
>             if(npts==3){
>             vTriangulos[j]= pts[0];
>             vTriangulos[j+1]= pts[1];
>             vTriangulos[j+2]= pts[2];
>             j+=3;
>             }
>
>      }
> _______________________________________________
> This is the private VTK discussion list.
> Please keep messages on-topic. Check the FAQ at: http://www.vtk.org/ 
> Wiki/VTK_FAQ
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20070516/22be916d/attachment.htm>


More information about the vtkusers mailing list