| 178 | |
| 179 | |
| 180 | PJ_LPZ pj_inv3d (PJ_XYZ xyz, PJ *P) { |
| 181 | int last_errno; |
| 182 | PJ_COORD coo = {{0,0,0,0}}; |
| 183 | coo.xyz = xyz; |
| 184 | |
| 185 | last_errno = proj_errno_reset(P); |
| 186 | |
| 187 | if (!P->skip_inv_prepare) |
| 188 | coo = inv_prepare (P, coo); |
| 189 | if (HUGE_VAL==coo.v[0]) |
| 190 | return proj_coord_error ().lpz; |
| 191 | |
| 192 | /* Do the transformation, using the lowest dimensional transformer feasible */ |
| 193 | if (P->inv3d) |
| 194 | coo.lpz = P->inv3d (coo.xyz, P); |
| 195 | else if (P->inv4d) |
| 196 | coo = P->inv4d (coo, P); |
| 197 | else if (P->inv) |
| 198 | coo.lp = P->inv (coo.xy, P); |
| 199 | else { |
| 200 | proj_errno_set (P, PROJ_ERR_OTHER_NO_INVERSE_OP); |
| 201 | return proj_coord_error ().lpz; |
| 202 | } |
| 203 | if (HUGE_VAL==coo.v[0]) |
| 204 | return proj_coord_error ().lpz; |
| 205 | |
| 206 | if (!P->skip_inv_finalize) |
| 207 | coo = inv_finalize (P, coo); |
| 208 | |
| 209 | return error_or_coord(P, coo, last_errno).lpz; |
| 210 | } |
| 211 | |
| 212 | |
| 213 |
no test coverage detected