3D cells use the ordered triangulator. The ordered triangulator is used to create templates on the fly. Once the templates are created then they are used to produce the final triangulation.
| 189 | // are used to produce the final triangulation. |
| 190 | // |
| 191 | void vtkDataSetTriangleFilter::UnstructuredExecute( |
| 192 | vtkDataSet* dataSetInput, vtkUnstructuredGrid* output) |
| 193 | { |
| 194 | vtkPointSet* input = static_cast<vtkPointSet*>(dataSetInput); // has to be |
| 195 | vtkIdType numCells = input->GetNumberOfCells(); |
| 196 | vtkGenericCell* cell; |
| 197 | vtkIdType newCellId, j; |
| 198 | int k; |
| 199 | vtkCellData* inCD = input->GetCellData(); |
| 200 | vtkCellData* outCD = output->GetCellData(); |
| 201 | vtkIdList* cellPtIds; |
| 202 | vtkIdType ptId, numTets, ncells; |
| 203 | int numPts, type; |
| 204 | int numSimplices, dim; |
| 205 | vtkIdType pts[4]; |
| 206 | double x[3]; |
| 207 | |
| 208 | if (numCells == 0) |
| 209 | { |
| 210 | outCD->CopyAllocate(inCD, 0); |
| 211 | output->GetPointData()->CopyAllocate(input->GetPointData(), 0); |
| 212 | return; |
| 213 | } |
| 214 | |
| 215 | vtkUnstructuredGrid* inUgrid = vtkUnstructuredGrid::SafeDownCast(dataSetInput); |
| 216 | if (inUgrid) |
| 217 | { |
| 218 | int allSimplices = 1; |
| 219 | for (vtkIdType cellId = 0; cellId < inUgrid->GetNumberOfCells() && allSimplices; cellId++) |
| 220 | { |
| 221 | switch (inUgrid->GetCellType(cellId)) |
| 222 | { |
| 223 | case VTK_TETRA: |
| 224 | break; |
| 225 | case VTK_VERTEX: |
| 226 | case VTK_LINE: |
| 227 | case VTK_TRIANGLE: |
| 228 | if (this->TetrahedraOnly) |
| 229 | { |
| 230 | allSimplices = 0; // don't shallowcopy need to strip non tets |
| 231 | } |
| 232 | break; |
| 233 | default: |
| 234 | allSimplices = 0; |
| 235 | break; |
| 236 | } |
| 237 | } |
| 238 | if (allSimplices) |
| 239 | { |
| 240 | output->ShallowCopy(input); |
| 241 | return; |
| 242 | } |
| 243 | } |
| 244 | |
| 245 | cell = vtkGenericCell::New(); |
| 246 | cellPtIds = vtkIdList::New(); |
| 247 | |
| 248 | // Create an array of points |
no test coverage detected