Determine type of intersection
| 1010 | |
| 1011 | // Determine type of intersection |
| 1012 | void vtkLoopBooleanPolyDataFilter::Impl::DetermineIntersection(std::vector<simLoop>* loops) |
| 1013 | { |
| 1014 | int numInterPts = this->IntersectionLines->GetNumberOfPoints(); |
| 1015 | bool* usedPt; |
| 1016 | usedPt = new bool[numInterPts]; |
| 1017 | for (vtkIdType interPt = 0; interPt < numInterPts; interPt++) |
| 1018 | { |
| 1019 | usedPt[interPt] = false; |
| 1020 | } |
| 1021 | |
| 1022 | for (vtkIdType interPt = 0; interPt < numInterPts; interPt++) |
| 1023 | { |
| 1024 | if (!usedPt[interPt]) |
| 1025 | { |
| 1026 | simLoop newloop; |
| 1027 | vtkSmartPointer<vtkIdList> cellIds = vtkSmartPointer<vtkIdList>::New(); |
| 1028 | this->IntersectionLines->GetPointCells(interPt, cellIds); |
| 1029 | if (cellIds->GetNumberOfIds() > 2) |
| 1030 | { |
| 1031 | vtkDebugWithObjectMacro( |
| 1032 | this->ParentFilter, << "Number Of Cells is greater than 2 for first point " << interPt); |
| 1033 | } |
| 1034 | else if (cellIds->GetNumberOfIds() < 2) |
| 1035 | { |
| 1036 | vtkDebugWithObjectMacro( |
| 1037 | this->ParentFilter, << "Number Of Cells is less than 2 for point " << interPt); |
| 1038 | } |
| 1039 | |
| 1040 | vtkIdType nextCell = cellIds->GetId(0); |
| 1041 | |
| 1042 | // Run through intersection lines to get loops! |
| 1043 | newloop.startPt = interPt; |
| 1044 | int caseId = 0; |
| 1045 | caseId = this->RunLoopFind(interPt, nextCell, usedPt, &newloop); |
| 1046 | if (caseId != -1) |
| 1047 | { |
| 1048 | // If the intersection loop is open |
| 1049 | if (this->IntersectionCase == 2) |
| 1050 | { |
| 1051 | vtkIdType nextPt = caseId; |
| 1052 | vtkDebugWithObjectMacro(this->ParentFilter, << "End point of open loop is " << nextPt); |
| 1053 | newloop.endPt = nextPt; |
| 1054 | newloop.loopType = 2; |
| 1055 | nextCell = cellIds->GetId(1); |
| 1056 | vtkIdType newId = this->RunLoopFind(interPt, nextCell, usedPt, &newloop); |
| 1057 | newloop.startPt = newId; |
| 1058 | // Save start and end point in custom data structure for loop |
| 1059 | } |
| 1060 | else |
| 1061 | { |
| 1062 | newloop.loopType = 1; |
| 1063 | } |
| 1064 | } |
| 1065 | usedPt[interPt] = true; |
| 1066 | loops->push_back(newloop); |
| 1067 | } |
| 1068 | } |
| 1069 | vtkDebugWithObjectMacro(this->ParentFilter, << "Number Of Loops: " << loops->size()); |
no test coverage detected