[vtkusers] Re: vtkusers Digest, Vol 12, Issue 4

Amy Squillacote amy.squillacote at kitware.com
Fri Apr 1 16:29:19 EST 2005


What happens if you take vtkStripper out of your code?  I think this would 
get rid of your problem with triangle strips because they would not be 
created in the first place.

- Amy

At 04:21 PM 4/1/2005, Jeffrey Meng wrote:
>Hi Amy,
>
>Basically, I am new to VTK, so I am really stupid.
>
>What I want to do is: I want to be able to iterate through a volume
>data as triangles, then change each triangle's color separately.
>And that's why I need vtkTriangleFilter. As to vtkStripper, I really
>don't know if I need it or not. :(
>
>So assume I have a vtkTriangleFilter object, I pass it to vtkPolyDataMapper.
>Now, the problem is how I iterate through the triangles?
>
>The code I wrote below was to iterate through the cells, hoping each
>cell is a triangle
>instead of a triangle strip, but looking at the execution, a Cell
>isn't a Triangle here. (It seems like a Cell is still a Triangle
>Strips, instead)
>
>---------------------------------------------------------------------------------------
>
>         vtkPolyData* pPolyData = pTriangles->GetOutput(); 
> //skinMapper->GetInput();
>         vtkCellData* pCellData = pPolyData->GetCellData();
>         vtkDataArray* pCellArray = pCellData->GetScalars();
>
>
>         int nTuples = pCellArray->GetNumberOfTuples();
>         for (int i = 0; i < nTuples / 2; ++i)
>         {
>                 pCellArray->SetTuple(i, scalar);
>         }
>
>         pCellArray->Modified();
>         pPolyData->Modified();
>
>---------------------------------------------------------------------------------------
>
>Thanks a lot.
>
>Best,
>Jeffrey
>
>
> > Hi Jeffrey,
> >
> > Why are you passing your data through vtkStripper and then through
> > vtkTriangleFilter?  This creates triangle strips and then breaks them back
> > apart.  When vtkTriangleFilter breaks the triangle strips apart, it copies
> > the cell data values of the entire triangle strip to each triangle that was
> > a part of that strip.  In VTK, a triangle strip is a single cell; there is
> > not separate cell data per triangle composing that strip.  If what you mean
> > by "the cell data still seems like triangle strips" is that the same value
> > is repeated for each triangle that was in a particular strip, this should
> > explain why.  If that is not what you mean, please clarify.
> >
> > - Amy
> >
>_______________________________________________
>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




More information about the vtkusers mailing list