------------------------------------------------------------------------------
| 2614 | |
| 2615 | //------------------------------------------------------------------------------ |
| 2616 | vtkFastGeomQuad* vtkDataSetSurfaceFilter::NewFastGeomQuad(int numPts) |
| 2617 | { |
| 2618 | if (this->FastGeomQuadArrayLength == 0) |
| 2619 | { |
| 2620 | vtkErrorMacro("Face hash allocation has not been initialized."); |
| 2621 | return nullptr; |
| 2622 | } |
| 2623 | |
| 2624 | // see if there's room for this one |
| 2625 | int polySize = sizeofFastQuad(numPts); |
| 2626 | if (this->NextQuadIndex + polySize > this->FastGeomQuadArrayLength) |
| 2627 | { |
| 2628 | ++(this->NextArrayIndex); |
| 2629 | this->NextQuadIndex = 0; |
| 2630 | } |
| 2631 | |
| 2632 | // Although this should not happen often, check first. |
| 2633 | if (this->NextArrayIndex >= this->NumberOfFastGeomQuadArrays) |
| 2634 | { |
| 2635 | int idx, num; |
| 2636 | unsigned char** newArrays; |
| 2637 | num = this->NumberOfFastGeomQuadArrays * 2; |
| 2638 | newArrays = new unsigned char*[num]; |
| 2639 | for (idx = 0; idx < num; ++idx) |
| 2640 | { |
| 2641 | newArrays[idx] = nullptr; |
| 2642 | if (idx < this->NumberOfFastGeomQuadArrays) |
| 2643 | { |
| 2644 | newArrays[idx] = this->FastGeomQuadArrays[idx]; |
| 2645 | } |
| 2646 | } |
| 2647 | delete[] this->FastGeomQuadArrays; |
| 2648 | this->FastGeomQuadArrays = newArrays; |
| 2649 | this->NumberOfFastGeomQuadArrays = num; |
| 2650 | } |
| 2651 | |
| 2652 | // Next: allocate a new array if necessary. |
| 2653 | if (this->FastGeomQuadArrays[this->NextArrayIndex] == nullptr) |
| 2654 | { |
| 2655 | this->FastGeomQuadArrays[this->NextArrayIndex] = |
| 2656 | new unsigned char[this->FastGeomQuadArrayLength]; |
| 2657 | } |
| 2658 | |
| 2659 | vtkFastGeomQuad* q = reinterpret_cast<vtkFastGeomQuad*>( |
| 2660 | this->FastGeomQuadArrays[this->NextArrayIndex] + this->NextQuadIndex); |
| 2661 | q->numPts = numPts; |
| 2662 | q->ptArray = (vtkIdType*)q + FSizeDivSizeId; |
| 2663 | |
| 2664 | this->NextQuadIndex += polySize; |
| 2665 | |
| 2666 | return q; |
| 2667 | } |
| 2668 | |
| 2669 | //------------------------------------------------------------------------------ |
| 2670 | void vtkDataSetSurfaceFilter::InitQuadHashTraversal() |
no test coverage detected