------------------------------------------------------------------------------
| 1049 | |
| 1050 | //------------------------------------------------------------------------------ |
| 1051 | vtkFastGeomQuad* vtkDataSetRegionSurfaceFilter::GetNextVisibleQuadFromHash() |
| 1052 | { |
| 1053 | if (!this->RegionArray) |
| 1054 | { |
| 1055 | this->Internal->NextRegion = -1; |
| 1056 | return this->Superclass::GetNextVisibleQuadFromHash(); |
| 1057 | } |
| 1058 | |
| 1059 | vtkFastGeomQuad* quad; |
| 1060 | quad = this->QuadHashTraversal; |
| 1061 | // Move till traversal until we have a quad to return. |
| 1062 | // Note: the current traversal has not been returned yet. |
| 1063 | while (quad == nullptr || quad->SourceId == -1) |
| 1064 | { |
| 1065 | if (quad) |
| 1066 | { // The quad must be hidden. Move to the next. |
| 1067 | quad = quad->Next; |
| 1068 | } |
| 1069 | else |
| 1070 | { // must be the end of the linked list. Move to the next bin. |
| 1071 | this->QuadHashTraversalIndex += 1; |
| 1072 | if (this->QuadHashTraversalIndex >= this->QuadHashLength) |
| 1073 | { // There are no more bins. |
| 1074 | this->QuadHashTraversal = nullptr; |
| 1075 | return nullptr; |
| 1076 | } |
| 1077 | quad = this->QuadHash[this->QuadHashTraversalIndex]; |
| 1078 | } |
| 1079 | } |
| 1080 | |
| 1081 | int mat1 = this->RegionArray->GetValue(quad->SourceId); |
| 1082 | |
| 1083 | if (!this->SingleSided) |
| 1084 | { |
| 1085 | this->Internal->NextRegion = mat1; |
| 1086 | } |
| 1087 | else |
| 1088 | { |
| 1089 | // preserve this quad's material in isolation (external faces) |
| 1090 | int matidx; |
| 1091 | std::pair<int, int> p = std::make_pair(mat1, -1); |
| 1092 | if (this->Internal->NewRegions.find(p) == this->Internal->NewRegions.end()) |
| 1093 | { |
| 1094 | matidx = static_cast<int>(this->Internal->NewRegions.size()); |
| 1095 | this->Internal->NewRegions[p] = matidx; |
| 1096 | this->Internal->OldToNew[mat1] = matidx; |
| 1097 | } |
| 1098 | matidx = this->Internal->NewRegions[p]; |
| 1099 | |
| 1100 | // look for this quad's twin across material interface. |
| 1101 | vtkFastGeomQuad* quad2; |
| 1102 | quad2 = quad->Next; |
| 1103 | int npts = quad->numPts; |
| 1104 | while (quad2) |
| 1105 | { |
| 1106 | bool match = false; |
| 1107 | if ((npts == 3) && (quad2->numPts == 3) && |
| 1108 | ((quad->ptArray[1] == quad2->ptArray[1] && quad->ptArray[2] == quad2->ptArray[2]) || |
no test coverage detected