diff --git a/src/gmt_map.c b/src/gmt_map.c index 8d0b6f5baad..4392c280e90 100644 --- a/src/gmt_map.c +++ b/src/gmt_map.c @@ -1161,12 +1161,16 @@ GMT_LOCAL int gmtmap_jump_x (struct GMT_CTRL *GMT, double x0, double y0, double dx = x1 - x0; if (fabs (dx) > map_half_size) { /* Possible jump; let's see how far apart those longitudes really are */ /* This test on longitudes was added to deal with issue #672, also see test/psxy/nojump.sh */ - double last_lon = 0.0, this_lon = 0.0, dummy = 0.0, dlon; + double last_lon = 0.0, this_lon = 0.0, dummy = 0.0, dlon, d0, d1; gmt_xy_to_geo (GMT, &last_lon, &dummy, x0, y0); gmt_xy_to_geo (GMT, &this_lon, &dummy, x1, y1); gmt_M_set_delta_lon (last_lon, this_lon, dlon); /* Beware of jumps due to sign differences */ if (fabs (dlon) < half_lon_range) /* Not going the long way so we judge this to be no jump */ return (0); + gmt_M_set_delta_lon (GMT->current.proj.central_meridian, last_lon, d0); /* Longitudes relative to the central meridian */ + gmt_M_set_delta_lon (GMT->current.proj.central_meridian, this_lon, d1); + if (fabs (d1 - d0) < 180.0) /* The straight path is the short way, so no jump */ + return (0); /* Jump it is */ if (dx > map_half_size) return (-1); /* Cross left/west boundary */ if (dx < (-map_half_size)) return (1); /* Cross right/east boundary */ diff --git a/test/baseline/psxy.dvc b/test/baseline/psxy.dvc index a2018e0e636..b1c26a3594e 100644 --- a/test/baseline/psxy.dvc +++ b/test/baseline/psxy.dvc @@ -1,5 +1,6 @@ outs: -- md5: fd04135cb8226c86f8f109e5dca463fe.dir +- md5: 6dbbc75aa2f8752b1450e4f22b7656f2.dir nfiles: 147 path: psxy hash: md5 + size: 9555170 diff --git a/test/psxy/nojump.sh b/test/psxy/nojump.sh index 7c3e43adb3f..0501c7a4427 100755 --- a/test/psxy/nojump.sh +++ b/test/psxy/nojump.sh @@ -1,5 +1,4 @@ #!/usr/bin/env bash -# GMT_KNOWN_FAILURE # Added after issue #672 which exposed a map jump that should not happen # Fixed in r14052 but we keep this test in case it resurfaces # Well, bottom panel plots the wrong closed polygon