Mark vtkPolyData boundary points. This is a little faster than using vtkMarkBoundaryFilter.
| 350 | // Mark vtkPolyData boundary points. This is a little faster than using |
| 351 | // vtkMarkBoundaryFilter. |
| 352 | void MarkPDBoundary(vtkPolyData* extractedEdges, vtkPolyData* inPolyData, unsigned char* smooth) |
| 353 | { |
| 354 | // Needed for topological edge neighbor) operations. |
| 355 | inPolyData->BuildLinks(); |
| 356 | |
| 357 | vtkCellArray* lines = extractedEdges->GetLines(); |
| 358 | vtkIdType numLines = lines->GetNumberOfCells(); |
| 359 | auto iter = vtk::TakeSmartPointer(lines->NewIterator()); |
| 360 | vtkIdType npts; |
| 361 | const vtkIdType* pts; |
| 362 | vtkNew<vtkIdList> neis; |
| 363 | |
| 364 | // Traverse all edges in the dataset and determine if they |
| 365 | // are boundary edges. |
| 366 | for (auto lineId = 0; lineId < numLines; ++lineId) |
| 367 | { |
| 368 | iter->GetCellAtId(lineId, npts, pts); |
| 369 | inPolyData->GetCellEdgeNeighbors((-1), pts[0], pts[1], neis); |
| 370 | if (neis->GetNumberOfIds() == 1) |
| 371 | { // it's a boundary edge |
| 372 | smooth[pts[0]] = Boundary; |
| 373 | smooth[pts[1]] = Boundary; |
| 374 | } |
| 375 | } |
| 376 | } // MarkPDBoundary |
| 377 | |
| 378 | // Mark boundary points for a general dataset. Boundary points are those that |
| 379 | // are used by boundary faces. Boundary faces are determined by executing the |
no test coverage detected