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+2);
+ triangleStrip1->GetPointIds()->SetNumberOfIds(numPointsFace*2+1);
if( normalOrder )
{
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);
+ triangleStrip1->GetPointIds()->SetId(triangleIndex+1,initial);//2
+ triangleStrip1->GetPointIds()->SetId(triangleIndex+2,centroidId);//3
+ }
+ else{
+ triangleStrip1->GetPointIds()->SetId(triangleIndex+1,centroidId);//1
}
triangleIndex+=2;
}
int triangleStripStart = end-1;
for(int index = triangleStripStart; index > initial; index-=increment){
triangleStrip1->GetPointIds()->SetId(triangleIndex,index);
- triangleStrip1->GetPointIds()->SetId(triangleIndex+1,centroidId);
if(index-increment <= initial){
- triangleStrip1->GetPointIds()->SetId(triangleIndex+2,triangleStripStart);
- triangleStrip1->GetPointIds()->SetId(triangleIndex+3,centroidId);
+ triangleStrip1->GetPointIds()->SetId(triangleIndex+1,triangleStripStart);
+ triangleStrip1->GetPointIds()->SetId(triangleIndex+2,centroidId);
+ }else{
+ triangleStrip1->GetPointIds()->SetId(triangleIndex+1,centroidId);
}
triangleIndex+=2;
}
double dotCalc;
dotCalc = vtkMath::Dot(normal, contrVect);
- return dotCalc>0;
+ return dotCalc<0;
}
/**
double center[3];
double firstRadiusSum = 0;
double secondRadiusSum = 0;
- for(int i = 0; i < lstIndexs[0] && lstIndexs[0] > 3; i+=3){
- if(i+3 <= lstIndexs[0]){
+ for(int i = 0; i < lstIndexs[0] && lstIndexs[0] > 9; i+=5){
+ if(i+10 < lstIndexs[0]){
points->GetPoint(i, point1);
- points->GetPoint(i+1, point2);
- points->GetPoint(i+2, point3);
+ points->GetPoint(i+5, point2);
+ points->GetPoint(i+10, point3);
firstRadiusSum += vtkMath::Solve3PointCircle(point1, point2, point3, center);
}
}
- for(int i = 0; i < sizePoints && lstIndexs.size() > 3; i+=(lstIndexs[0]*3)){
- if(i+(3*lstIndexs[0]) <= sizePoints){
+ for(int i = 0; i < sizePoints && lstIndexs.size() > 9; i+=(lstIndexs.size()*5)){
+ if(i+(10*lstIndexs.size()) < sizePoints){
points->GetPoint(i, point1);
- points->GetPoint(i+lstIndexs[0], point2);
- points->GetPoint(i+(2*lstIndexs[0]), point3);
+ points->GetPoint(i+(5*lstIndexs.size()), point2);
+ points->GetPoint(i+(10*lstIndexs.size()), point3);
secondRadiusSum += vtkMath::Solve3PointCircle(point1, point2, point3, center);
}
}
-
+ //cout << firstRadiusSum << endl;
+ //cout << secondRadiusSum << endl;
return firstRadiusSum > secondRadiusSum;
}