- if(validCentroid){
- bool normalOrder = isPointingCorrectly(firstIndex, firstIndex+increment, centroid, contraryId);
- centroidId = points->InsertNextPoint(centroid[0], centroid[1], centroid[2]);
- vtkSmartPointer<vtkTriangleStrip> triangleStrip1 = vtkSmartPointer<vtkTriangleStrip>::New();
- triangleStrip1->GetPointIds()->SetNumberOfIds(numPointsFace*2+1);
- if(normalOrder){ //(facesIdx == 0 && uPointOrder) || (facesIdx == 1 && !uPointOrder)){
- int initial = firstIndex;
- int triangleIndex = 0;
- for(int index = initial; index < end; index+=increment){
- triangleStrip1->GetPointIds()->SetId(triangleIndex,index);
- if(index+increment >= end){
- triangleStrip1->GetPointIds()->SetId(triangleIndex+1,initial);
- triangleStrip1->GetPointIds()->SetId(triangleIndex+2,centroidId);
- }
- else{
- triangleStrip1->GetPointIds()->SetId(triangleIndex+1,centroidId);
+ if(validCentroid)
+ {
+ bool normalOrder = isPointingCorrectly(firstIndex, firstIndex+increment, centroid, contraryId);
+ centroidId = points->InsertNextPoint(centroid[0], centroid[1], centroid[2]);
+ if( normalOrder )
+ {
+ 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);