- int initial = firstIndex;
- int triangleIndex = 0;
- for(int index = initial; index < end; index+=increment){
- triangleStrip1->GetPointIds()->SetId(triangleIndex,index);
- triangleStrip1->GetPointIds()->SetId(triangleIndex+1,centroidId);
- if(index+increment >= end){
- triangleStrip1->GetPointIds()->SetId(triangleIndex+2,initial);
- triangleStrip1->GetPointIds()->SetId(triangleIndex+3,centroidId);
+ int initial = firstIndex;
+ for(int index = initial; index < end; index+=increment){
+ if(index+increment >= end && !isClosedCont){
+ vtkNew<vtkTriangle> triangle;
+ triangle->GetPointIds()->SetId(0, index);
+ triangle->GetPointIds()->SetId(1, initial);
+ triangle->GetPointIds()->SetId(2, centroidId);
+ cells->InsertNextCell(triangle);
+ }else if(index+increment < end){
+ vtkNew<vtkTriangle> triangle;
+ triangle->GetPointIds()->SetId(0, index);
+ triangle->GetPointIds()->SetId(1, index+increment);
+ triangle->GetPointIds()->SetId(2, centroidId);
+ cells->InsertNextCell(triangle);