------------------------------------------------------------------------------
| 2402 | |
| 2403 | //------------------------------------------------------------------------------ |
| 2404 | void vtkDataSetSurfaceFilter::InsertTriInHash( |
| 2405 | vtkIdType a, vtkIdType b, vtkIdType c, vtkIdType sourceId, vtkIdType vtkNotUsed(faceId) /*= -1*/) |
| 2406 | { |
| 2407 | vtkIdType tmp; |
| 2408 | vtkFastGeomQuad *quad, **end; |
| 2409 | |
| 2410 | // Reorder to get smallest id in a. |
| 2411 | if (b < a && b < c) |
| 2412 | { |
| 2413 | tmp = a; |
| 2414 | a = b; |
| 2415 | b = c; |
| 2416 | c = tmp; |
| 2417 | } |
| 2418 | else if (c < a && c < b) |
| 2419 | { |
| 2420 | tmp = a; |
| 2421 | a = c; |
| 2422 | c = b; |
| 2423 | b = tmp; |
| 2424 | } |
| 2425 | // We can't put the second smallest in b because it might change the order |
| 2426 | // of the vertices in the final triangle. |
| 2427 | |
| 2428 | // Look for existing tri in the hash; |
| 2429 | end = this->QuadHash + a; |
| 2430 | quad = *end; |
| 2431 | while (quad) |
| 2432 | { |
| 2433 | end = &(quad->Next); |
| 2434 | // a has to match in this bin. |
| 2435 | if (quad->numPts == 3) |
| 2436 | { |
| 2437 | if ((b == quad->ptArray[1] && c == quad->ptArray[2]) || |
| 2438 | (b == quad->ptArray[2] && c == quad->ptArray[1])) |
| 2439 | { |
| 2440 | // We have a match. |
| 2441 | quad->SourceId = -1; |
| 2442 | // That is all we need to do. Hide any tri shared by two or more cells. |
| 2443 | return; |
| 2444 | } |
| 2445 | } |
| 2446 | quad = *end; |
| 2447 | } |
| 2448 | |
| 2449 | // Create a new quad and add it to the hash. |
| 2450 | quad = this->NewFastGeomQuad(3); |
| 2451 | quad->Next = nullptr; |
| 2452 | quad->SourceId = sourceId; |
| 2453 | quad->ptArray[0] = a; |
| 2454 | quad->ptArray[1] = b; |
| 2455 | quad->ptArray[2] = c; |
| 2456 | *end = quad; |
| 2457 | } |
| 2458 | |
| 2459 | // Insert a polygon into the hash. |
| 2460 | // Input: an array of vertex ids |
no test coverage detected