------------------------------------------------------------------------------
| 784 | |
| 785 | //------------------------------------------------------------------------------ |
| 786 | int vtkLoopBooleanPolyDataFilter::RequestData(vtkInformation* vtkNotUsed(request), |
| 787 | vtkInformationVector** inputVector, vtkInformationVector* outputVector) |
| 788 | { |
| 789 | vtkInformation* inInfo0 = inputVector[0]->GetInformationObject(0); |
| 790 | vtkInformation* inInfo1 = inputVector[1]->GetInformationObject(0); |
| 791 | vtkInformation* outInfo0 = outputVector->GetInformationObject(0); |
| 792 | vtkInformation* outInfo1 = outputVector->GetInformationObject(1); |
| 793 | |
| 794 | if (!inInfo0 || !inInfo1 || !outInfo0 || !outInfo1) |
| 795 | { |
| 796 | this->Status = 0; |
| 797 | return 0; |
| 798 | } |
| 799 | |
| 800 | vtkPolyData* input0 = vtkPolyData::SafeDownCast(inInfo0->Get(vtkDataObject::DATA_OBJECT())); |
| 801 | vtkPolyData* input1 = vtkPolyData::SafeDownCast(inInfo1->Get(vtkDataObject::DATA_OBJECT())); |
| 802 | |
| 803 | vtkPolyData* outputSurface = |
| 804 | vtkPolyData::SafeDownCast(outInfo0->Get(vtkDataObject::DATA_OBJECT())); |
| 805 | vtkPolyData* outputIntersection = |
| 806 | vtkPolyData::SafeDownCast(outInfo1->Get(vtkDataObject::DATA_OBJECT())); |
| 807 | |
| 808 | if (!input0 || !input1 || !outputSurface || !outputIntersection) |
| 809 | { |
| 810 | this->Status = 0; |
| 811 | return 0; |
| 812 | } |
| 813 | |
| 814 | // Get intersected versions |
| 815 | vtkSmartPointer<vtkIntersectionPolyDataFilter> polydataIntersection = |
| 816 | vtkSmartPointer<vtkIntersectionPolyDataFilter>::New(); |
| 817 | polydataIntersection->SetInputConnection(0, this->GetInputConnection(0, 0)); |
| 818 | polydataIntersection->SetInputConnection(1, this->GetInputConnection(1, 0)); |
| 819 | polydataIntersection->SplitFirstOutputOn(); |
| 820 | polydataIntersection->SplitSecondOutputOn(); |
| 821 | polydataIntersection->SetTolerance(this->Tolerance); |
| 822 | polydataIntersection->SetContainerAlgorithm(this); |
| 823 | polydataIntersection->Update(); |
| 824 | if (this->CheckAbort() || polydataIntersection->GetStatus() != 1) |
| 825 | { |
| 826 | this->Status = 0; |
| 827 | return 0; |
| 828 | } |
| 829 | |
| 830 | this->NumberOfIntersectionPoints = polydataIntersection->GetNumberOfIntersectionPoints(); |
| 831 | this->NumberOfIntersectionLines = polydataIntersection->GetNumberOfIntersectionLines(); |
| 832 | |
| 833 | vtkDebugMacro(<< "Intersection is Done!!!"); |
| 834 | |
| 835 | vtkLoopBooleanPolyDataFilter::Impl* impl = new vtkLoopBooleanPolyDataFilter::Impl(); |
| 836 | impl->ParentFilter = this; |
| 837 | impl->Mesh[0]->DeepCopy(polydataIntersection->GetOutput(1)); |
| 838 | impl->Mesh[0]->BuildLinks(); |
| 839 | impl->Mesh[1]->DeepCopy(polydataIntersection->GetOutput(2)); |
| 840 | impl->Mesh[1]->BuildLinks(); |
| 841 | impl->IntersectionLines->ShallowCopy(polydataIntersection->GetOutput(0)); |
| 842 | |
| 843 | if (this->NumberOfIntersectionPoints == 0 || this->NumberOfIntersectionLines == 0) |
nothing calls this directly
no test coverage detected