[vtkusers] xxxxxSPAMxxxxx VtkIdType Polygon

alex alexdowson at hotmail.com
Wed Jul 7 09:49:47 EDT 2010


Hi

I have some array of polygon in which some is triangles,some is quads, some 
is polygon. Mean it is mixed array. It renders peferct as i need.

Now my question is i want to do some collision detection stuff and it need 
triangles as input so do i need to convert this n-side polygon into 
triangles ?


My arrays are looks like this.

static vtkIdType pid3[3][3]= {{41,56,49},{42,49,50},{43,50,51},};
static vtkIdType pid4[3][4] ={{0,1,9,2},{0,2,11,3},{0,3,13,4},}
static vtkIdType pid5[3][5] = 
{{87,88,9,1,24},{57,58,10,2,9},{59,60,11,2,10},}
static vtkIdType pid8[8]= {56,55,54,53,52,51,50,49};


I am using this code right now is this.

 // copy cells
 vtkIdType* polys = poly->GetPolys()->GetPointer();

 for (int i=0; i<numCellFirst; i++)
 {
  udword a = *(polys+1+i*4);
  udword b = *(polys+2+i*4);
  udword c = *(polys+3+i*4);

// copy to collision detection

 triangles[i] = IndexedTriangle(a,b,c);

 }


Any clue ?

Alex






More information about the vtkusers mailing list