Tests an orientation in a specified region
| 1179 | |
| 1180 | // Tests an orientation in a specified region |
| 1181 | int vtkLoopBooleanPolyDataFilter::Impl::RunLoopTest( |
| 1182 | vtkIdType interPt, vtkIdType nextCell, simLoop* loop, bool* usedPt) |
| 1183 | { |
| 1184 | // This test is only if the intersection has soft closed loops |
| 1185 | vtkDebugWithObjectMacro(this->ParentFilter, << "Running Loop Test to find right loop"); |
| 1186 | vtkIdType stopCell = nextCell; |
| 1187 | vtkIdType prevPt = interPt; |
| 1188 | vtkIdType nextPt = interPt; |
| 1189 | vtkSmartPointer<vtkIdList> pointIds = vtkSmartPointer<vtkIdList>::New(); |
| 1190 | vtkSmartPointer<vtkPolyData> tmpPolyData = vtkSmartPointer<vtkPolyData>::New(); |
| 1191 | int input = 0; |
| 1192 | tmpPolyData->DeepCopy(this->Mesh[input]); |
| 1193 | tmpPolyData->BuildLinks(); |
| 1194 | std::list<simLine>::iterator cellit; |
| 1195 | |
| 1196 | vtkSmartPointer<vtkIdList> cellIds = vtkSmartPointer<vtkIdList>::New(); |
| 1197 | IntersectionLines->GetPointCells(nextPt, cellIds); |
| 1198 | vtkDebugWithObjectMacro(this->ParentFilter, |
| 1199 | << "Number of cells should be more than two!! " << cellIds->GetNumberOfIds()); |
| 1200 | for (vtkIdType i = 0; i < cellIds->GetNumberOfIds(); i++) |
| 1201 | { |
| 1202 | int numRegionsFound = 0; |
| 1203 | vtkIdType cellId = cellIds->GetId(i); |
| 1204 | vtkDebugWithObjectMacro(this->ParentFilter, << "Testing cell " << cellId); |
| 1205 | IntersectionLines->GetCellPoints(cellId, pointIds); |
| 1206 | if (pointIds->GetNumberOfIds() > 2) |
| 1207 | { |
| 1208 | vtkDebugWithObjectMacro( |
| 1209 | this->ParentFilter, << "Number Of Points is greater than 2 for first cell " << nextCell); |
| 1210 | } |
| 1211 | else if (pointIds->GetNumberOfIds() < 2) |
| 1212 | { |
| 1213 | vtkDebugWithObjectMacro( |
| 1214 | this->ParentFilter, << "Number Of Points is less than 2 for first cell " << nextCell); |
| 1215 | } |
| 1216 | |
| 1217 | if (pointIds->GetId(0) == interPt) |
| 1218 | { |
| 1219 | nextPt = pointIds->GetId(1); |
| 1220 | } |
| 1221 | else |
| 1222 | { |
| 1223 | nextPt = pointIds->GetId(0); |
| 1224 | } |
| 1225 | |
| 1226 | if (usedPt[nextPt]) |
| 1227 | { |
| 1228 | vtkDebugWithObjectMacro(this->ParentFilter, << "Bad One"); |
| 1229 | } |
| 1230 | if (cellId != stopCell && !usedPt[nextPt]) |
| 1231 | { |
| 1232 | simLine newline; |
| 1233 | newline.id = cellId; |
| 1234 | newline.pt1 = prevPt; |
| 1235 | newline.pt2 = nextPt; |
| 1236 | loop->cells.push_back(newline); |
| 1237 | vtkDebugWithObjectMacro(this->ParentFilter, << "Cell id is: " << cellId); |
| 1238 | for (cellit = loop->cells.begin(); cellit != loop->cells.end(); ++cellit) |
no test coverage detected