| 63 | } |
| 64 | |
| 65 | void vtkDataSetTriangleFilter::StructuredExecute(vtkDataSet* input, vtkUnstructuredGrid* output) |
| 66 | { |
| 67 | int dimensions[3], i, j, k, l, m; |
| 68 | vtkIdType newCellId, inId; |
| 69 | vtkCellData* inCD = input->GetCellData(); |
| 70 | vtkCellData* outCD = output->GetCellData(); |
| 71 | vtkPoints* newPoints = vtkPoints::New(); |
| 72 | vtkIdList* cellPtIds = vtkIdList::New(); |
| 73 | int numSimplices, numPts, dim, type; |
| 74 | vtkIdType pts[4], num; |
| 75 | |
| 76 | // Create an array of points. This does an explicit creation |
| 77 | // of each point. |
| 78 | num = input->GetNumberOfPoints(); |
| 79 | newPoints->SetNumberOfPoints(num); |
| 80 | for (i = 0; i < num; ++i) |
| 81 | { |
| 82 | newPoints->SetPoint(i, input->GetPoint(i)); |
| 83 | } |
| 84 | |
| 85 | outCD->CopyAllocate(inCD, input->GetNumberOfCells() * 5); |
| 86 | output->Allocate(input->GetNumberOfCells() * 5); |
| 87 | |
| 88 | if (input->IsA("vtkStructuredPoints")) |
| 89 | { |
| 90 | static_cast<vtkStructuredPoints*>(input)->GetDimensions(dimensions); |
| 91 | } |
| 92 | else if (input->IsA("vtkStructuredGrid")) |
| 93 | { |
| 94 | static_cast<vtkStructuredGrid*>(input)->GetDimensions(dimensions); |
| 95 | } |
| 96 | else if (input->IsA("vtkImageData")) |
| 97 | { |
| 98 | static_cast<vtkImageData*>(input)->GetDimensions(dimensions); |
| 99 | } |
| 100 | else if (input->IsA("vtkRectilinearGrid")) |
| 101 | { |
| 102 | static_cast<vtkRectilinearGrid*>(input)->GetDimensions(dimensions); |
| 103 | } |
| 104 | else |
| 105 | { |
| 106 | // Every kind of structured data is listed above, this should never happen. |
| 107 | // Report an error and produce no output. |
| 108 | vtkErrorMacro("Unrecognized data set " << input->GetClassName()); |
| 109 | // Dimensions of 1x1x1 means a single point, i.e. dimensionality of zero. |
| 110 | dimensions[0] = 1; |
| 111 | dimensions[1] = 1; |
| 112 | dimensions[2] = 1; |
| 113 | } |
| 114 | |
| 115 | dimensions[0] = dimensions[0] - 1; |
| 116 | dimensions[1] = dimensions[1] - 1; |
| 117 | dimensions[2] = dimensions[2] - 1; |
| 118 | |
| 119 | vtkIdType numSlices = (dimensions[2] > 0 ? dimensions[2] : 1); |
| 120 | bool abort = false; |
| 121 | for (k = 0; k < numSlices && !abort; k++) |
| 122 | { |
no test coverage detected