------------------------------------------------------------------------------
| 269 | |
| 270 | //------------------------------------------------------------------------------ |
| 271 | bool vtkCellValidator::ContiguousEdges(vtkCell* twoDimensionalCell, double tolerance) |
| 272 | { |
| 273 | // Ensures that a two-dimensional cell's edges are contiguous. |
| 274 | // |
| 275 | // NB: we cannot simply test the values of point ids, since cells have the |
| 276 | // tricky habit of generating their edge cells on the fly and cell Ids are |
| 277 | // only congruent w.r.t. a single point array. To be thorough, we need to |
| 278 | // compare point values. |
| 279 | |
| 280 | assert(twoDimensionalCell->GetCellDimension() == 2); |
| 281 | |
| 282 | double points[4][3]; |
| 283 | double *p[2] = { points[0], points[1] }, *x[2] = { points[2], points[3] }, u, v; |
| 284 | vtkCell* edge = twoDimensionalCell->GetEdge(0); |
| 285 | vtkIdType nEdges = twoDimensionalCell->GetNumberOfEdges(); |
| 286 | // Need to use local indices, not global |
| 287 | edge->GetPoints()->GetPoint(0, p[0]); |
| 288 | edge->GetPoints()->GetPoint(1, p[1]); |
| 289 | for (vtkIdType i = 0; i < nEdges; i++) |
| 290 | { |
| 291 | edge = twoDimensionalCell->GetEdge((i + 1) % nEdges); |
| 292 | // Need to use local indices, not global |
| 293 | edge->GetPoints()->GetPoint(0, x[0]); |
| 294 | edge->GetPoints()->GetPoint(1, x[1]); |
| 295 | |
| 296 | vtkLine::Intersection(p[0], p[1], x[0], x[1], u, v, vtkMath::Inf()); |
| 297 | if ((std::abs(u) > tolerance && std::abs(1. - u) > tolerance) || |
| 298 | (std::abs(v) > tolerance && std::abs(1. - v) > tolerance)) |
| 299 | { |
| 300 | return false; |
| 301 | } |
| 302 | p[0] = x[0]; |
| 303 | p[1] = x[1]; |
| 304 | } |
| 305 | return true; |
| 306 | } |
| 307 | |
| 308 | //------------------------------------------------------------------------------ |
| 309 | namespace |
nothing calls this directly
no test coverage detected