aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKristian Evers <kristianevers@gmail.com>2018-03-31 00:14:12 +0200
committerKristian Evers <kristianevers@gmail.com>2018-03-31 00:14:12 +0200
commitf8aacfb513c9380c4df3b2dda124c0b1da7aaa3c (patch)
tree7043a35841615c64eb6f2941a124c8d206b2e8fe /src
parent038e3f0a508b7908f16f3517dcb0bc87d6275ab5 (diff)
parent1f2532a5bf6f52e24a984fb15a7fc742e3bcad15 (diff)
downloadPROJ-f8aacfb513c9380c4df3b2dda124c0b1da7aaa3c.tar.gz
PROJ-f8aacfb513c9380c4df3b2dda124c0b1da7aaa3c.zip
Merge remote-tracking branch 'osgeo/master' into doc-improvements
Diffstat (limited to 'src')
-rw-r--r--src/PJ_helmert.c3
-rw-r--r--src/PJ_ortho.c34
2 files changed, 22 insertions, 15 deletions
diff --git a/src/PJ_helmert.c b/src/PJ_helmert.c
index 229e30c2..5ff8c5d2 100644
--- a/src/PJ_helmert.c
+++ b/src/PJ_helmert.c
@@ -134,7 +134,8 @@ static void update_parameters(PJ *P) {
/* debugging output */
if (proj_log_level(P->ctx, PJ_LOG_TELL) >= PJ_LOG_TRACE) {
- proj_log_trace(P, "Transformation parameters for observation t_epoch %g:", Q->t_obs);
+ proj_log_trace(P, "Transformation parameters for observation "
+ "t_obs=%g (t_epoch=%g):", Q->t_obs, Q->t_epoch);
proj_log_trace(P, "x: %g", Q->xyz.x);
proj_log_trace(P, "y: %g", Q->xyz.y);
proj_log_trace(P, "z: %g", Q->xyz.z);
diff --git a/src/PJ_ortho.c b/src/PJ_ortho.c
index 5b3770d0..7c27cd56 100644
--- a/src/PJ_ortho.c
+++ b/src/PJ_ortho.c
@@ -1,6 +1,7 @@
#define PJ_LIB__
#include <errno.h>
#include "proj.h"
+#include "proj_internal.h"
#include "projects.h"
PROJ_HEAD(ortho, "Orthographic") "\n\tAzi, Sph.";
@@ -20,37 +21,39 @@ struct pj_opaque {
#define EPS10 1.e-10
+static XY forward_error(PJ *P, LP lp, XY xy) {
+ proj_errno_set(P, PJD_ERR_TOLERANCE_CONDITION);
+ proj_log_trace(P, "Coordinate (%.3f, %.3f) is on the unprojected hemisphere",
+ proj_todeg(lp.lam), proj_todeg(lp.phi));
+ return xy;
+}
static XY s_forward (LP lp, PJ *P) { /* Spheroidal, forward */
- XY xy = {0.0,0.0};
+ XY xy;
struct pj_opaque *Q = P->opaque;
double coslam, cosphi, sinphi;
+ xy.x = HUGE_VAL; xy.y = HUGE_VAL;
+
cosphi = cos(lp.phi);
coslam = cos(lp.lam);
switch (Q->mode) {
case EQUIT:
- if (cosphi * coslam < - EPS10) {
- proj_errno_set(P, PJD_ERR_TOLERANCE_CONDITION);
- return xy;
- }
+ if (cosphi * coslam < - EPS10)
+ return forward_error(P, lp, xy);
xy.y = sin(lp.phi);
break;
case OBLIQ:
- if (Q->sinph0 * (sinphi = sin(lp.phi)) + Q->cosph0 * cosphi * coslam < - EPS10) {
- proj_errno_set(P, PJD_ERR_TOLERANCE_CONDITION);
- return xy;
- }
+ if (Q->sinph0 * (sinphi = sin(lp.phi)) + Q->cosph0 * cosphi * coslam < - EPS10)
+ return forward_error(P, lp, xy);
xy.y = Q->cosph0 * sinphi - Q->sinph0 * cosphi * coslam;
break;
case N_POLE:
coslam = - coslam;
/*-fallthrough*/
case S_POLE:
- if (fabs(lp.phi - P->phi0) - EPS10 > M_HALFPI) {
- proj_errno_set(P, PJD_ERR_TOLERANCE_CONDITION);
- return xy;
- }
+ if (fabs(lp.phi - P->phi0) - EPS10 > M_HALFPI)
+ return forward_error(P, lp, xy);
xy.y = cosphi * coslam;
break;
}
@@ -60,13 +63,16 @@ static XY s_forward (LP lp, PJ *P) { /* Spheroidal, forward */
static LP s_inverse (XY xy, PJ *P) { /* Spheroidal, inverse */
- LP lp = {0.0,0.0};
+ LP lp;
struct pj_opaque *Q = P->opaque;
double rh, cosc, sinc;
+ lp.lam = HUGE_VAL; lp.phi = HUGE_VAL;
+
if ((sinc = (rh = hypot(xy.x, xy.y))) > 1.) {
if ((sinc - 1.) > EPS10) {
proj_errno_set(P, PJD_ERR_TOLERANCE_CONDITION);
+ proj_log_trace(P, "Point (%.3f, %.3f) is outside the projection boundary");
return lp;
}
sinc = 1.;