------------------------------------------------------------------------------
| 56 | |
| 57 | //------------------------------------------------------------------------------ |
| 58 | int vtkBooleanOperationPolyDataFilter::RequestData(vtkInformation* vtkNotUsed(request), |
| 59 | vtkInformationVector** inputVector, vtkInformationVector* outputVector) |
| 60 | { |
| 61 | vtkInformation* inInfo0 = inputVector[0]->GetInformationObject(0); |
| 62 | vtkInformation* inInfo1 = inputVector[1]->GetInformationObject(0); |
| 63 | vtkInformation* outInfo0 = outputVector->GetInformationObject(0); |
| 64 | vtkInformation* outInfo1 = outputVector->GetInformationObject(1); |
| 65 | |
| 66 | if (!inInfo0 || !inInfo1 || !outInfo0 || !outInfo1) |
| 67 | { |
| 68 | return 0; |
| 69 | } |
| 70 | |
| 71 | vtkPolyData* input0 = vtkPolyData::SafeDownCast(inInfo0->Get(vtkDataObject::DATA_OBJECT())); |
| 72 | vtkPolyData* input1 = vtkPolyData::SafeDownCast(inInfo1->Get(vtkDataObject::DATA_OBJECT())); |
| 73 | |
| 74 | vtkPolyData* outputSurface = |
| 75 | vtkPolyData::SafeDownCast(outInfo0->Get(vtkDataObject::DATA_OBJECT())); |
| 76 | vtkPolyData* outputIntersection = |
| 77 | vtkPolyData::SafeDownCast(outInfo1->Get(vtkDataObject::DATA_OBJECT())); |
| 78 | |
| 79 | if (!input0 || !input1 || !outputSurface || !outputIntersection) |
| 80 | { |
| 81 | return 0; |
| 82 | } |
| 83 | |
| 84 | // Get intersected versions |
| 85 | vtkSmartPointer<vtkIntersectionPolyDataFilter> PolyDataIntersection = |
| 86 | vtkSmartPointer<vtkIntersectionPolyDataFilter>::New(); |
| 87 | PolyDataIntersection->SetInputConnection(0, this->GetInputConnection(0, 0)); |
| 88 | PolyDataIntersection->SetInputConnection(1, this->GetInputConnection(1, 0)); |
| 89 | PolyDataIntersection->SplitFirstOutputOn(); |
| 90 | PolyDataIntersection->SplitSecondOutputOn(); |
| 91 | PolyDataIntersection->SetContainerAlgorithm(this); |
| 92 | PolyDataIntersection->Update(); |
| 93 | |
| 94 | if (PolyDataIntersection->GetStatus() != 1) |
| 95 | { |
| 96 | return 0; |
| 97 | } |
| 98 | |
| 99 | outputIntersection->CopyStructure(PolyDataIntersection->GetOutput()); |
| 100 | outputIntersection->GetPointData()->PassData(PolyDataIntersection->GetOutput()->GetPointData()); |
| 101 | outputIntersection->GetCellData()->PassData(PolyDataIntersection->GetOutput()->GetCellData()); |
| 102 | |
| 103 | // Compute distances |
| 104 | vtkSmartPointer<vtkDistancePolyDataFilter> PolyDataDistance = |
| 105 | vtkSmartPointer<vtkDistancePolyDataFilter>::New(); |
| 106 | |
| 107 | PolyDataDistance->SetInputConnection(0, PolyDataIntersection->GetOutputPort(1)); |
| 108 | PolyDataDistance->SetInputConnection(1, PolyDataIntersection->GetOutputPort(2)); |
| 109 | PolyDataDistance->ComputeSecondDistanceOn(); |
| 110 | PolyDataDistance->SetContainerAlgorithm(this); |
| 111 | PolyDataDistance->Update(); |
| 112 | |
| 113 | vtkPolyData* pd0 = PolyDataDistance->GetOutput(); |
| 114 | vtkPolyData* pd1 = PolyDataDistance->GetSecondDistanceOutput(); |
| 115 |
nothing calls this directly
no test coverage detected