------------------------------------------------------------------------------ CellGrid: Subdivide cells in consistent tetrahedra. Case : Voxel or Hexahedron: if ( subdivide voxel in 6 tetrahedra) voxel : 2 wedges (*) else voxel : 5 tetrahedra Case : Wedge (*) ------------------------------------------------ (*) WedgeToTetra: subdivide one wedge in 3 tetrahedra wedge : 1 tetrahedron + 1 pyram
| 775 | // wedge : 1 tetrahedron + 1 pyramid = 3 tetrahedra. |
| 776 | // |
| 777 | void vtkBoxClipDataSet::WedgeToTetra( |
| 778 | const vtkIdType* wedgeId, const vtkIdType* cellIds, vtkCellArray* newCellArray) |
| 779 | { |
| 780 | int i; |
| 781 | int id; |
| 782 | vtkIdType xmin; |
| 783 | vtkIdType tab[4]; |
| 784 | vtkIdType tabpyram[5]; |
| 785 | |
| 786 | constexpr vtkIdType vwedge[6][4] = { |
| 787 | { 0, 4, 3, 5 }, |
| 788 | { 1, 4, 3, 5 }, |
| 789 | { 2, 4, 3, 5 }, |
| 790 | { 3, 0, 1, 2 }, |
| 791 | { 4, 0, 1, 2 }, |
| 792 | { 5, 0, 1, 2 }, |
| 793 | }; |
| 794 | |
| 795 | // the table 'vwedge' set 6 possibilities of the smallest index |
| 796 | // |
| 797 | // v5 |
| 798 | // /\ . |
| 799 | // v3 /..\ v4 |
| 800 | // / / |
| 801 | // v2/\ / |
| 802 | // v0/__\/v1 |
| 803 | // if(v0 index ) is the smallest index: |
| 804 | // wedge is subdivided in: |
| 805 | // 1 tetrahedron-> vwedge[0]: {v0,v4,v3,v5} |
| 806 | // and 1 pyramid -> vert[0] : {v1,v2,v5,v4,v0} |
| 807 | // |
| 808 | |
| 809 | id = 0; |
| 810 | xmin = cellIds[wedgeId[0]]; |
| 811 | for (i = 1; i < 6; i++) |
| 812 | { |
| 813 | if (xmin > cellIds[wedgeId[i]]) |
| 814 | { |
| 815 | xmin = cellIds[wedgeId[i]]; // the smallest global index |
| 816 | id = i; // local index |
| 817 | } |
| 818 | } |
| 819 | for (i = 0; i < 4; i++) |
| 820 | { |
| 821 | tab[i] = wedgeId[vwedge[id][i]]; |
| 822 | } |
| 823 | newCellArray->InsertNextCell(4, tab); |
| 824 | |
| 825 | // Pyramid :create 2 tetrahedra |
| 826 | constexpr vtkIdType vert[6][5] = { |
| 827 | { 1, 2, 5, 4, 0 }, |
| 828 | { 2, 0, 3, 5, 1 }, |
| 829 | { 3, 0, 1, 4, 2 }, |
| 830 | { 1, 2, 5, 4, 3 }, |
| 831 | { 2, 0, 3, 5, 4 }, |
| 832 | { 3, 0, 1, 4, 5 }, |
| 833 | }; |
| 834 | for (i = 0; i < 5; i++) |
no test coverage detected