From 1a229007c110544dbae6cd69ca50a3860cf18037 Mon Sep 17 00:00:00 2001 From: Esteban82 Date: Wed, 18 Nov 2026 19:19:15 -0300 Subject: [PATCH 1/2] Fix stray gridlines across windowed genper maps gmtmap_genper_crossing and gmtmap_genperw_overlap call the radial and rectangular *_outside tests, which overwrite this_x_status/this_y_status. For a point beyond the horizon whose projection falls inside the window, the status became "inside", gmt_map_outside then copied it to prev_*, and gmtmap_crossing reported a crossing on every segment behind the horizon. gmtmap_radial_crossing then extrapolated those crossings, drawing straight chords across the map and an arc outside the frame. Save and restore the status around the tests in both functions, and drop the GMT_KNOWN_FAILURE flag from test/genper/gridlines2.sh. Co-Authored-By: Claude Opus 5.5 --- src/gmt_map.c | 4 ++++ test/genper/gridlines2.sh | 1 - 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/gmt_map.c b/src/gmt_map.c index 8d0b6f5baad..d0e32982d66 100644 --- a/src/gmt_map.c +++ b/src/gmt_map.c @@ -1121,12 +1121,14 @@ GMT_LOCAL unsigned int gmtmap_genper_crossing (struct GMT_CTRL *GMT, double lon1 * Approach: Determine how the points do relative to either boundary. */ bool h_out[2], r_out[2]; + int x_status = GMT->current.map.this_x_status, y_status = GMT->current.map.this_y_status; /* The tests below overwrite these */ /* Check if point 1 is beyond horizon: */ h_out[0] = gmtmap_radial_outside (GMT, lon1, lat1); /* true if point 1 is beyond the horizon */ h_out[1] = gmtmap_radial_outside (GMT, lon2, lat2); /* true if point 2 is beyond the horizon */ r_out[0] = gmtmap_rect_outside (GMT, lon1, lat1); /* true if point 1 is beyond the map box */ r_out[1] = gmtmap_rect_outside (GMT, lon2, lat2); /* true if point 2 is beyond the map box */ + GMT->current.map.this_x_status = x_status; GMT->current.map.this_y_status = y_status; if (h_out[0] == false && h_out[1] == false) /* We are not beyond horizon so technically inside unless clipped by the window: */ return (gmtmap_rect_crossing (GMT, lon1, lat1, lon2, lat2, clon, clat, xx, yy, sides)); if (r_out[0] == false && r_out[1] == false) /* We are not outside the map box but might be beyond horizon: */ @@ -2252,6 +2254,7 @@ GMT_LOCAL bool gmtmap_genperg_overlap (struct GMT_CTRL *GMT, double lon0, double /*! . */ GMT_LOCAL bool gmtmap_genperw_overlap (struct GMT_CTRL *GMT, double lon0, double lat0, double lon1, double lat1) { bool out0, out1; + int x_status = GMT->current.map.this_x_status, y_status = GMT->current.map.this_y_status; /* The tests below overwrite these */ gmt_M_unused(lon0); gmt_M_unused(lat0); gmt_M_unused(lon1); gmt_M_unused(lat1); /* Return true if either of the points (lon0,lat0) and (lon1,lat1) is inside (not on) the windowed genper boundary */ /* Check if point 1 is beyond horizon: */ @@ -2259,6 +2262,7 @@ GMT_LOCAL bool gmtmap_genperw_overlap (struct GMT_CTRL *GMT, double lon0, double if (!out0) out0 = gmtmap_rect_outside (GMT, lon0, lat0); /* true if point 0 is beyond the map box */ out1 = gmtmap_radial_outside (GMT, lon1, lat1); /* true if point 1 is beyond the horizon */ if (!out1) out1 = gmtmap_rect_outside (GMT, lon1, lat1); /* true if point 1 is beyond the map box */ + GMT->current.map.this_x_status = x_status; GMT->current.map.this_y_status = y_status; return (out0 != out1); } diff --git a/test/genper/gridlines2.sh b/test/genper/gridlines2.sh index 502eaf4ad0e..9229b27faac 100755 --- a/test/genper/gridlines2.sh +++ b/test/genper/gridlines2.sh @@ -1,5 +1,4 @@ #!/usr/bin/env bash -# GMT_KNOWN_FAILURE # More testing of issue #667, item #5 ps=gridlines2.ps lon0=225.989251068 From 25ac130b43d30ef53f1b4496f552f27847f03b22 Mon Sep 17 00:00:00 2001 From: Esteban82 Date: Thu, 19 Nov 2026 09:43:00 -0300 Subject: [PATCH 2/2] Add the new gridlines2 baseline --- test/baseline/genper.dvc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/baseline/genper.dvc b/test/baseline/genper.dvc index 93198c3f15c..d22bbf9f841 100644 --- a/test/baseline/genper.dvc +++ b/test/baseline/genper.dvc @@ -1,5 +1,6 @@ outs: -- md5: 4f8356486a3cc544654ed1c8432eb15a.dir +- md5: 0f6c62886e8929d67fa38f51757e2a16.dir nfiles: 20 path: genper hash: md5 + size: 4164738