Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/gmt_plot.c
Original file line number Diff line number Diff line change
Expand Up @@ -6155,6 +6155,11 @@ GMT_LOCAL void gmtplot_get_outside_point_extension (struct GMT_CTRL *GMT, double
L = 0.0;
else /* Safe to get width (but still truncate to width of map) */
L = MIN (fabs (W / tan_angle), GMT->current.map.half_width); /* L is positive */
/* For lines that cross the border at a shallow (near-tangent) angle, L can blow up far beyond
* the segment that defines the crossing direction, producing a visible stray line segment
* (https://github.com/GenericMappingTools/gmt/issues/5954). The extension should never need
* to reach further than the segment itself, so cap it at that segment's length. */
L = MIN (L, hypot (dx, dy));
/* Compute the coordinates of the point at a distance L away from clip point in the direction of angle */
*x_off = x_on - L * cosd (angle);
*y_off = y_on - L * sind (angle);
Expand Down
4 changes: 4 additions & 0 deletions src/seis/pssac.c
Original file line number Diff line number Diff line change
Expand Up @@ -674,6 +674,8 @@ EXTERN_MSC int GMT_pssac (void *V_API, int mode, void *args) { /* High-level fun
}
GMT_Report (API, GMT_MSG_INFORMATION, "Collecting %ld SAC files to plot.\n", n_files);

gmt_map_clip_on (GMT, GMT->session.no_rgb, 3); /* Clip to map so border-crossing traces don't leak stray pen segments outside the frame */

for (n = 0; n < (int)n_files; n++) { /* Loop over all SAC files */
GMT_Report (API, GMT_MSG_INFORMATION, "Plotting SAC file %d: %s\n", n, L[n].file);

Expand Down Expand Up @@ -937,6 +939,8 @@ EXTERN_MSC int GMT_pssac (void *V_API, int mode, void *args) { /* High-level fun
gmt_M_free (GMT, L);
gmt_M_free (GMT, Ctrl->In.file);

gmt_map_clip_off (GMT);

if (Ctrl->D.active) PSL_setorigin (PSL, -Ctrl->D.dx, -Ctrl->D.dy, 0.0, PSL_FWD); /* Reset shift */

PSL_setdash (PSL, NULL, 0);
Expand Down
Loading