Triangle Strips

Matthew Hall mahall at
Fri Dec 17 12:21:46 EST 1999

Note that VTK uses an indexed scheme for strips - I.e. the vtkPointData
is not
ordered at all. (Which might explain why you were getting triangles from
all over)
The ordering is actually stored in an array of integers (encased in a
vtkCellArray). The format is:
(m,i1,i2,i3,i4,  , n,i1,i2,..., in,...)
where m and n are the number of vertices in a strip and the i's are
indexes into
the point data. The triangles are stored as mentioned below. 

Thus, given vtkPolyData, you can extract the strips as follows - this
would print out the vertex coordinates for each triangle in the strip.
non-optimized code here!)

void PrintTriangle(float *,float *, float *);	//just a big 'ol cout<<

void PrintStrips(){

vtkPolyData *mypoly = ...;
vtkPoints *mypoints = mypoly->GetPoints();
vtkCellArray *mystrips = mypoly->GetStrips();

int *indices=mystrips->GetPointer();
int numindices=mystrips->GetNumberOfConnectivityEntries(); //Whoa!
int idx=0;

while (idx<numindices){
    int striplen=indices[idx];  //Get length of next strip
    for (int jj=0;jj<striplen-2;jj++){
	float A[3],B[3],C[3];  //coordinates of triangle vertices

I would imaging that OpenInventor's indexed triangle strip format is
within epsilon of VTK's - i.e. the number of vertices in the strip,
by the indices of the vertices. VTK just stuffs 'em all into one big


Will Schroeder wrote:
> Hi Nils-
> First three points define a triangle (p0,p1,p2), then each additional point p3 defines a triangle by using (p1,p2,p3) and so on.
> Will
> At 05:00 PM 12/17/99 +0100, Nils Holger Busch wrote:
> >Hello,
> >
> >can anyone enlighten me how the cell and point structure of a
> >vtkPolyData triangle strip as output from vtkStripper actually looks
> >like? I found the description in the book  a little terse.
> >
> >Specifically, I need to transform the vtk triangle strips into
> >OpenInventor triangle strips (either SoTriangleStripSet or
> >SoIndexedTriangleStripSet, depending on the vtk format). Has anyone done
> >this and is willing to share his code.
> >
> >I have tried transforming the vtk triangle strips into a
> >SoTriangleStripSet, but the output has the wrong toplogy ( jagged
> >triangles connecting separate triangle strips ).
> >
> >Thanks.
> >
> >--
> >Best regards,
> >                                          Nils H. Busch
> >

This is the private VTK discussion list.  Please keep messages on-topic.
Check the FAQ at: <>
To UNSUBSCRIBE, send message body containing "unsubscribe vtkusers" to
<majordomo at>.  For help, send message body containing
"info vtkusers" to the same address.     Live long and prosper.

More information about the vtkusers mailing list