| 183 | } |
| 184 | |
| 185 | PJ_XY pj_fwd(PJ_LP lp, PJ *P) { |
| 186 | PJ_COORD coo = {{0, 0, 0, 0}}; |
| 187 | coo.lp = lp; |
| 188 | |
| 189 | const int last_errno = P->ctx->last_errno; |
| 190 | P->ctx->last_errno = 0; |
| 191 | |
| 192 | if (!P->skip_fwd_prepare) |
| 193 | fwd_prepare(P, coo); |
| 194 | if (HUGE_VAL == coo.v[0] || HUGE_VAL == coo.v[1]) |
| 195 | return proj_coord_error().xy; |
| 196 | |
| 197 | /* Do the transformation, using the lowest dimensional transformer available |
| 198 | */ |
| 199 | if (P->fwd) { |
| 200 | const auto xy = P->fwd(coo.lp, P); |
| 201 | coo.xy = xy; |
| 202 | } else if (P->fwd3d) { |
| 203 | const auto xyz = P->fwd3d(coo.lpz, P); |
| 204 | coo.xyz = xyz; |
| 205 | } else if (P->fwd4d) |
| 206 | P->fwd4d(coo, P); |
| 207 | else { |
| 208 | proj_errno_set(P, PROJ_ERR_OTHER_NO_INVERSE_OP); |
| 209 | return proj_coord_error().xy; |
| 210 | } |
| 211 | if (HUGE_VAL == coo.v[0]) |
| 212 | return proj_coord_error().xy; |
| 213 | |
| 214 | if (!P->skip_fwd_finalize) |
| 215 | fwd_finalize(P, coo); |
| 216 | |
| 217 | return error_or_coord(P, coo, last_errno).xy; |
| 218 | } |
| 219 | |
| 220 | PJ_XYZ pj_fwd3d(PJ_LPZ lpz, PJ *P) { |
| 221 | PJ_COORD coo = {{0, 0, 0, 0}}; |
no test coverage detected