------------------------------------------------------------------------------
| 2334 | |
| 2335 | //------------------------------------------------------------------------------ |
| 2336 | void vtkDataSetSurfaceFilter::InsertQuadInHash( |
| 2337 | vtkIdType a, vtkIdType b, vtkIdType c, vtkIdType d, vtkIdType sourceId) |
| 2338 | { |
| 2339 | vtkIdType tmp; |
| 2340 | vtkFastGeomQuad *quad, **end; |
| 2341 | |
| 2342 | // Reorder to get smallest id in a. |
| 2343 | if (b < a && b < c && b < d) |
| 2344 | { |
| 2345 | tmp = a; |
| 2346 | a = b; |
| 2347 | b = c; |
| 2348 | c = d; |
| 2349 | d = tmp; |
| 2350 | } |
| 2351 | else if (c < a && c < b && c < d) |
| 2352 | { |
| 2353 | tmp = a; |
| 2354 | a = c; |
| 2355 | c = tmp; |
| 2356 | tmp = b; |
| 2357 | b = d; |
| 2358 | d = tmp; |
| 2359 | } |
| 2360 | else if (d < a && d < b && d < c) |
| 2361 | { |
| 2362 | tmp = a; |
| 2363 | a = d; |
| 2364 | d = c; |
| 2365 | c = b; |
| 2366 | b = tmp; |
| 2367 | } |
| 2368 | |
| 2369 | // Look for existing quad in the hash; |
| 2370 | end = this->QuadHash + a; |
| 2371 | quad = *end; |
| 2372 | while (quad) |
| 2373 | { |
| 2374 | end = &(quad->Next); |
| 2375 | // a has to match in this bin. |
| 2376 | // c should be independent of point order. |
| 2377 | if (quad->numPts == 4 && c == quad->ptArray[2]) |
| 2378 | { |
| 2379 | // Check both orders for b and d. |
| 2380 | if ((b == quad->ptArray[1] && d == quad->ptArray[3]) || |
| 2381 | (b == quad->ptArray[3] && d == quad->ptArray[1])) |
| 2382 | { |
| 2383 | // We have a match. |
| 2384 | quad->SourceId = -1; |
| 2385 | // That is all we need to do. Hide any quad shared by two or more cells. |
| 2386 | return; |
| 2387 | } |
| 2388 | } |
| 2389 | quad = *end; |
| 2390 | } |
| 2391 | |
| 2392 | // Create a new quad and add it to the hash. |
| 2393 | quad = this->NewFastGeomQuad(4); |
no test coverage detected