| 151 | } |
| 152 | |
| 153 | PJ_LP pj_inv(PJ_XY xy, PJ *P) { |
| 154 | PJ_COORD coo = {{0, 0, 0, 0}}; |
| 155 | coo.xy = xy; |
| 156 | |
| 157 | const int last_errno = P->ctx->last_errno; |
| 158 | P->ctx->last_errno = 0; |
| 159 | |
| 160 | if (!P->skip_inv_prepare) |
| 161 | inv_prepare(P, coo); |
| 162 | if (HUGE_VAL == coo.v[0]) |
| 163 | return proj_coord_error().lp; |
| 164 | |
| 165 | /* Do the transformation, using the lowest dimensional transformer available |
| 166 | */ |
| 167 | if (P->inv) { |
| 168 | const auto lp = P->inv(coo.xy, P); |
| 169 | coo.lp = lp; |
| 170 | } else if (P->inv3d) { |
| 171 | const auto lpz = P->inv3d(coo.xyz, P); |
| 172 | coo.lpz = lpz; |
| 173 | } else if (P->inv4d) |
| 174 | P->inv4d(coo, P); |
| 175 | else { |
| 176 | proj_errno_set(P, PROJ_ERR_OTHER_NO_INVERSE_OP); |
| 177 | return proj_coord_error().lp; |
| 178 | } |
| 179 | if (HUGE_VAL == coo.v[0]) |
| 180 | return proj_coord_error().lp; |
| 181 | |
| 182 | if (!P->skip_inv_finalize) |
| 183 | inv_finalize(P, coo); |
| 184 | |
| 185 | return error_or_coord(P, coo, last_errno).lp; |
| 186 | } |
| 187 | |
| 188 | PJ_LPZ pj_inv3d(PJ_XYZ xyz, PJ *P) { |
| 189 | PJ_COORD coo = {{0, 0, 0, 0}}; |
no test coverage detected