Measure numerical deviation after n roundtrips fwd-inv (or inv-fwd) */
| 169 | |
| 170 | /* Measure numerical deviation after n roundtrips fwd-inv (or inv-fwd) */ |
| 171 | double proj_roundtrip (PJ *P, PJ_DIRECTION direction, int n, PJ_COORD *coord) { |
| 172 | int i; |
| 173 | PJ_COORD t, org; |
| 174 | |
| 175 | if (nullptr==P) |
| 176 | return HUGE_VAL; |
| 177 | |
| 178 | if (n < 1) { |
| 179 | proj_log_error(P, _("n should be >= 1")); |
| 180 | proj_errno_set (P, PROJ_ERR_OTHER_API_MISUSE); |
| 181 | return HUGE_VAL; |
| 182 | } |
| 183 | |
| 184 | /* in the first half-step, we generate the output value */ |
| 185 | org = *coord; |
| 186 | *coord = proj_trans (P, direction, org); |
| 187 | t = *coord; |
| 188 | |
| 189 | /* now we take n-1 full steps in inverse direction: We are */ |
| 190 | /* out of phase due to the half step already taken */ |
| 191 | for (i = 0; i < n - 1; i++) |
| 192 | t = proj_trans (P, direction, proj_trans (P, opposite_direction(direction), t) ); |
| 193 | |
| 194 | /* finally, we take the last half-step */ |
| 195 | t = proj_trans (P, opposite_direction(direction), t); |
| 196 | |
| 197 | /* checking for angular *input* since we do a roundtrip, and end where we begin */ |
| 198 | if (proj_angular_input (P, direction)) |
| 199 | return proj_lpz_dist (P, org, t); |
| 200 | |
| 201 | return proj_xyz_dist (org, t); |
| 202 | } |
| 203 | |
| 204 | /**************************************************************************************/ |
| 205 | int pj_get_suggested_operation(PJ_CONTEXT*, |
nothing calls this directly
no test coverage detected