diff options
| author | Kristian Evers <kristianevers@gmail.com> | 2018-05-06 17:40:44 +0300 |
|---|---|---|
| committer | Kristian Evers <kristianevers@gmail.com> | 2018-05-08 09:16:07 +0200 |
| commit | 8fef2126f1c9fa17b79e6669f4457c299c0e33bf (patch) | |
| tree | 7eca710cef66514c79d8124be29cc061d946cc96 /src | |
| parent | 987603a4ab2b925363fdcb6bf99fa89658d67613 (diff) | |
| download | PROJ-8fef2126f1c9fa17b79e6669f4457c299c0e33bf.tar.gz PROJ-8fef2126f1c9fa17b79e6669f4457c299c0e33bf.zip | |
Handle HUGE_VAL input better in fwd and inv functions
Diffstat (limited to 'src')
| -rw-r--r-- | src/pj_fwd.c | 5 | ||||
| -rw-r--r-- | src/pj_inv.c | 3 |
2 files changed, 5 insertions, 3 deletions
diff --git a/src/pj_fwd.c b/src/pj_fwd.c index 347f8334..4b6cfc58 100644 --- a/src/pj_fwd.c +++ b/src/pj_fwd.c @@ -30,6 +30,7 @@ #include <errno.h> #include "proj_internal.h" +#include "proj_math.h" #include "projects.h" #define INPUT_UNITS P->left @@ -37,7 +38,7 @@ static PJ_COORD fwd_prepare (PJ *P, PJ_COORD coo) { - if (HUGE_VAL==coo.v[0]) + if (HUGE_VAL==coo.v[0] || HUGE_VAL==coo.v[1] || HUGE_VAL==coo.v[2]) return proj_coord_error (); /* The helmert datum shift will choke unless it gets a sensible 4D coordinate */ @@ -191,7 +192,7 @@ XY pj_fwd(LP lp, PJ *P) { if (!P->skip_fwd_prepare) coo = fwd_prepare (P, coo); - if (HUGE_VAL==coo.v[0]) + if (HUGE_VAL==coo.v[0] || HUGE_VAL==coo.v[1]) return proj_coord_error ().xy; /* Do the transformation, using the lowest dimensional transformer available */ diff --git a/src/pj_inv.c b/src/pj_inv.c index 327fef9f..25d416c0 100644 --- a/src/pj_inv.c +++ b/src/pj_inv.c @@ -30,13 +30,14 @@ #include <errno.h> #include "proj_internal.h" +#include "proj_math.h" #include "projects.h" #define INPUT_UNITS P->right #define OUTPUT_UNITS P->left static PJ_COORD inv_prepare (PJ *P, PJ_COORD coo) { - if (coo.xyz.x == HUGE_VAL) { + if (coo.v[0] == HUGE_VAL || coo.v[1] == HUGE_VAL || coo.v[2] == HUGE_VAL) { proj_errno_set (P, PJD_ERR_INVALID_X_OR_Y); return proj_coord_error (); } |
