[vtkusers] questions on building cells

Petru Pau ppau at risc.uni-linz.ac.at
Tue Jun 8 09:28:06 EDT 2004


1. Is there a direct way to extract triangles and only triangles from a
vtkPolyData?

2. If I create a model by inserting its points and edges, what I obtain
does not contain anything else, I guess: the polygonal lines are not there.
Take for instance next code snippet:

           float[][] x = new float[4][]{
                                                new float[]{0,0,0},
                                                new float[]{1,0,1},
                                                new float[]{1,1,1},
                                                new float[]{1,2,2}
                                           };
           vtkPolyData model = vtkPolyData.New();
           vtkPoints points = vtkPoints.New();
                      // Load the point, cell, and data attributes.
           for (int i=0; i<4; i++) points.InsertPoint(i,x[i]);

           // We now assign the pieces to the vtkPolyData.
           model = vtkPolyData.New();
           model.SetPoints(points);
           points.Delete();
           model.Allocate(1000,1000);
           model.InsertNextCell(3,2,new int[]{0,1});
           model.InsertNextCell(3,2,new int[]{1,2});
           model.InsertNextCell(3,2,new int[]{2,0});
           model.InsertNextCell(3,2,new int[]{2,3});
           model.Squeeze();

This model has four straight line segments; three of them form a
triangle, the other is a "dangling edge".

How can I persuade the model to build higher level cells? (I mean,
at least triangles.) The following sentences:

           model.BuildCells();
           int nrCells = model.GetNumberOfPolys();

have no visible effect, i.e., nrCells will be 0. What does, then, 
BuildCells do?

3. What does vtkTriangleFilter do? If I apply it to the previous model,
the output of this filter will be the same as the input.

Petru


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20040608/0761c35a/attachment.htm>


More information about the vtkusers mailing list