\brief Given the index, \a subCell, of a linear approximating-hex, translate pcoords from that * hex into this nonlinear hex. * * You must call this->GetOrder() **before** invoking this method as it assumes * the order is up to date. */
| 812 | * the order is up to date. |
| 813 | */ |
| 814 | bool vtkHigherOrderWedge::TransformApproxToCellParams(int subCell, double* pcoords) |
| 815 | { |
| 816 | const int* order = this->Order; |
| 817 | int rsOrder = order[0]; |
| 818 | int tOrder = order[2]; |
| 819 | vtkVector3i ijk; |
| 820 | bool orientation; |
| 821 | #ifdef VTK_21_POINT_WEDGE |
| 822 | if (order[3] == 21) |
| 823 | { |
| 824 | int triIdx = subCell % 6; |
| 825 | vtkVector3d triPt0 = vtkVector3d( |
| 826 | &vtkHigherOrderWedge21ParametricCoords[3 * vtkHigherOrderWedge21EdgePoints[triIdx]]); |
| 827 | vtkVector3d triPt1 = vtkVector3d( |
| 828 | &vtkHigherOrderWedge21ParametricCoords[3 * vtkHigherOrderWedge21EdgePoints[triIdx + 1]]); |
| 829 | vtkVector3d triPt2 = |
| 830 | vtkVector3d(&vtkHigherOrderWedge21ParametricCoords[3 * vtkHigherOrderWedge21InteriorPt]); |
| 831 | vtkVector3d rst(pcoords); |
| 832 | vtkVector3d rDir = triPt1 - triPt0; |
| 833 | vtkVector3d sDir = triPt2 - triPt0; |
| 834 | pcoords[0] = triPt0[0] + rst[0] * rDir[0] + rst[1] * sDir[0]; |
| 835 | pcoords[1] = triPt0[1] + rst[0] * rDir[1] + rst[1] * sDir[1]; |
| 836 | pcoords[2] = ((subCell / 6) ? 0.0 : 0.5) + 0.5 * rst[2]; |
| 837 | return true; |
| 838 | } |
| 839 | #endif |
| 840 | if (!linearWedgeLocationFromSubId(subCell, rsOrder, tOrder, ijk[0], ijk[1], ijk[2], orientation)) |
| 841 | { |
| 842 | return false; |
| 843 | } |
| 844 | |
| 845 | if (orientation) |
| 846 | { // positive orientation |
| 847 | for (int pp = 0; pp < 2; ++pp) |
| 848 | { |
| 849 | pcoords[pp] = (pcoords[pp] + ijk[pp]) / order[pp]; |
| 850 | } |
| 851 | } |
| 852 | else |
| 853 | { // negative orientation: wedge origin is at i+1,j+1 and axes point backwards toward i+0,j+0. |
| 854 | for (int pp = 0; pp < 2; ++pp) |
| 855 | { |
| 856 | pcoords[pp] = (ijk[pp] + 1 - pcoords[pp]) / order[pp]; |
| 857 | } |
| 858 | } |
| 859 | |
| 860 | // k-axis is always positively oriented from k+0 to k+1: |
| 861 | pcoords[2] = (pcoords[2] + ijk[2]) / tOrder; |
| 862 | |
| 863 | return true; |
| 864 | } |
| 865 | |
| 866 | /**\brief Given the index, \a subCell, of a linear approximating-wedge, translate pcoords from that |
| 867 | * wedge into this nonlinear wedge. |
no test coverage detected