| 19 | vtkApproximatingSubdivisionFilter::vtkApproximatingSubdivisionFilter() = default; |
| 20 | |
| 21 | int vtkApproximatingSubdivisionFilter::RequestData( |
| 22 | vtkInformation* request, vtkInformationVector** inputVector, vtkInformationVector* outputVector) |
| 23 | { |
| 24 | if (!this->Superclass::RequestData(request, inputVector, outputVector)) |
| 25 | { |
| 26 | return 0; |
| 27 | } |
| 28 | |
| 29 | // get the info objects |
| 30 | vtkInformation* inInfo = inputVector[0]->GetInformationObject(0); |
| 31 | vtkInformation* outInfo = outputVector->GetInformationObject(0); |
| 32 | |
| 33 | // get the input and output |
| 34 | vtkPolyData* input = vtkPolyData::SafeDownCast(inInfo->Get(vtkDataObject::DATA_OBJECT())); |
| 35 | vtkPolyData* output = vtkPolyData::SafeDownCast(outInfo->Get(vtkDataObject::DATA_OBJECT())); |
| 36 | |
| 37 | vtkIdType numCells, numPts; |
| 38 | int level; |
| 39 | vtkPoints* outputPts; |
| 40 | |
| 41 | vtkCellArray* outputPolys; |
| 42 | vtkPointData* outputPD; |
| 43 | vtkCellData* outputCD; |
| 44 | vtkIntArray* edgeData; |
| 45 | |
| 46 | vtkDebugMacro(<< "Generating subdivision surface using approximating scheme"); |
| 47 | numPts = input->GetNumberOfPoints(); |
| 48 | numCells = input->GetNumberOfCells(); |
| 49 | |
| 50 | // |
| 51 | // Initialize and check input |
| 52 | // |
| 53 | |
| 54 | vtkPolyData* inputDS = vtkPolyData::New(); |
| 55 | inputDS->CopyStructure(input); |
| 56 | inputDS->CopyAttributes(input); |
| 57 | |
| 58 | bool abort = false; |
| 59 | for (level = 0; level < this->NumberOfSubdivisions && !abort; level++) |
| 60 | { |
| 61 | this->UpdateProgress(static_cast<double>(level + 1) / this->NumberOfSubdivisions); |
| 62 | abort = this->CheckAbort(); |
| 63 | |
| 64 | // Generate topology for the input dataset |
| 65 | inputDS->BuildLinks(); |
| 66 | |
| 67 | numCells = inputDS->GetNumberOfCells(); |
| 68 | numPts = inputDS->GetNumberOfPoints(); |
| 69 | |
| 70 | // The points for the subdivisions will |
| 71 | // include even points (computed from old points) and |
| 72 | // odd points (inserted on edges) |
| 73 | outputPts = vtkPoints::New(); |
| 74 | outputPts->Allocate(numPts); |
| 75 | |
| 76 | // Copy pointdata structure from input |
| 77 | outputPD = vtkPointData::New(); |
| 78 | outputPD->CopyAllocate(inputDS->GetPointData(), 2 * inputDS->GetNumberOfPoints()); |
nothing calls this directly
no test coverage detected