------------------------------------------------------------------------------
| 203 | |
| 204 | //------------------------------------------------------------------------------ |
| 205 | void vtkSelectPolyData::DijkstraEdgeSearch(vtkPolyData* mesh, vtkIdList* edgePointIds) |
| 206 | { |
| 207 | vtkNew<vtkDijkstraGraphGeodesicPath> edgeSearchFilter; |
| 208 | edgeSearchFilter->StopWhenEndReachedOn(); |
| 209 | edgeSearchFilter->SetInputData(mesh); |
| 210 | |
| 211 | vtkNew<vtkPointLocator> pointLocator; |
| 212 | pointLocator->SetDataSet(mesh); |
| 213 | |
| 214 | vtkPoints* inPts = mesh->GetPoints(); |
| 215 | vtkIdType numLoopPts = this->Loop->GetNumberOfPoints(); |
| 216 | |
| 217 | vtkIdType currentId = 0; |
| 218 | double xLoop[3]; |
| 219 | this->Loop->GetPoint(0, xLoop); |
| 220 | vtkIdType nextId = pointLocator->FindClosestPoint(xLoop); |
| 221 | for (vtkIdType i = 0; i < numLoopPts; i++) |
| 222 | { |
| 223 | if (this->CheckAbort()) |
| 224 | { |
| 225 | break; |
| 226 | } |
| 227 | currentId = nextId; |
| 228 | this->Loop->GetPoint((i + 1) % numLoopPts, xLoop); |
| 229 | nextId = pointLocator->FindClosestPoint(xLoop); |
| 230 | |
| 231 | edgeSearchFilter->SetStartVertex(currentId); |
| 232 | edgeSearchFilter->SetEndVertex(nextId); |
| 233 | edgeSearchFilter->Update(); |
| 234 | vtkPolyData* outputPath = edgeSearchFilter->GetOutput(); |
| 235 | double x0[3]; |
| 236 | inPts->GetPoint(currentId, x0); |
| 237 | for (int j = outputPath->GetNumberOfPoints() - 1; j >= 0; --j) |
| 238 | { |
| 239 | double x[3]; |
| 240 | outputPath->GetPoint(j, x); |
| 241 | double dist2 = vtkMath::Distance2BetweenPoints(x, x0); |
| 242 | if (dist2 > 0.0) |
| 243 | { |
| 244 | // Find point ID to add in the input mesh to remember the next edge point |
| 245 | edgePointIds->InsertNextId(pointLocator->FindClosestPoint(x)); |
| 246 | for (int k = 0; k < 3; ++k) |
| 247 | { |
| 248 | // Remember last added point so that it does not get added twice |
| 249 | x0[k] = x[k]; |
| 250 | } |
| 251 | } |
| 252 | } |
| 253 | } |
| 254 | } |
| 255 | |
| 256 | //------------------------------------------------------------------------------ |
| 257 | int vtkSelectPolyData::RequestData(vtkInformation* vtkNotUsed(request), |
no test coverage detected