Skip to content
Draft
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
18 changes: 18 additions & 0 deletions src/gmt_map.c
Original file line number Diff line number Diff line change
Expand Up @@ -8011,6 +8011,15 @@ uint64_t gmtlib_lonpath (struct GMT_CTRL *GMT, double lon, double lat1, double l
/* Must do general case */
n = 0;
min_gap = 0.1 * GMT->current.setting.map_line_step;
if (!isfinite (GMT->current.map.dlat) || GMT->current.map.dlat <= 0.0) { /* Guard against invalid sampling step (e.g., antipodal singularities) */
gmt_M_malloc2 (GMT, tlon, tlat, 2U, NULL, double);
tlon[0] = tlon[1] = lon;
tlat[0] = lat1;
tlat[1] = lat2;
*x = tlon;
*y = tlat;
return (2ULL);
}
if ((n_alloc = lrint (ceil (fabs (lat2 - lat1) / GMT->current.map.dlat))) == 0) return (0);

n_alloc++; /* So n_alloc is at least 2 */
Expand Down Expand Up @@ -8108,6 +8117,15 @@ uint64_t gmtlib_latpath (struct GMT_CTRL *GMT, double lat, double lon1, double l
}
/* Here we try to walk along lat for small increment in longitude to make sure our steps are smaller than the line_step */
min_gap = 0.1 * GMT->current.setting.map_line_step;
if (!isfinite (GMT->current.map.dlon) || GMT->current.map.dlon <= 0.0) { /* Guard against invalid sampling step (e.g., antipodal singularities) */
gmt_M_malloc2 (GMT, tlon, tlat, 2U, NULL, double);
tlat[0] = tlat[1] = lat;
tlon[0] = lon1;
tlon[1] = lon2;
*x = tlon;
*y = tlat;
return (2ULL);
}
if ((n_alloc = lrint (ceil (fabs (lon2 - lon1) / GMT->current.map.dlon))) == 0) return (0); /* Initial guess to path length */

n_alloc++; /* n_alloc is at least 2 */
Expand Down