From 7d6247dcbac7cb092149b82cc49d4c0cdbd346bb Mon Sep 17 00:00:00 2001 From: Joaquim Date: Sat, 16 Mar 2024 14:53:30 +0000 Subject: [PATCH] Improve the test that checks if central lon is < |180| --- src/gmt_map.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gmt_map.c b/src/gmt_map.c index 714d61b350f..1cea55dadf0 100644 --- a/src/gmt_map.c +++ b/src/gmt_map.c @@ -389,9 +389,9 @@ GMT_LOCAL int gmtmap_cyl_validate_clon (struct GMT_CTRL *GMT, unsigned int mode) bool is_reg0360 = GMT->common.R.wesn[XLO] > 180 || GMT->common.R.wesn[XHI] > 180; /* Is the region in the [0 360] range */ clon = GMT->current.proj.pars[0]; - if (is_clon0360 && !is_reg0360) /* Must take care of not checking for clon < 180 from either boundary and mix -Rg & -Rd */ + if (is_clon0360 && !is_reg0360 && clon > 180) /* Must take care of not checking for clon < 180 from either boundary and mix -Rg & -Rd */ clon -= 360.0; - else if (!is_clon0360 && is_reg0360) + else if (!is_clon0360 && is_reg0360 && clon < 0) clon += 360.0; dw = fabs (clon - GMT->common.R.wesn[XLO]); if (dw >= 360) dw -= 360.0; de = fabs (clon - GMT->common.R.wesn[XHI]); if (de >= 360) de -= 360.0;