| 915 | } |
| 916 | |
| 917 | GMT_LOCAL double gmtplot_shift_gridline (struct GMT_CTRL *GMT, double val, unsigned int type) { |
| 918 | /* Only for oblique projections: If any of the corners are exactly multiples of annotation |
| 919 | * or tick intervals then the gridline intersection may fail (tangent or slightly outside |
| 920 | * due to round-off). We determine which gridlines go through the corners and shift them |
| 921 | * a tiny bit to the inside to ensure crossings */ |
| 922 | double shift = 0.0; |
| 923 | if (!GMT->common.R.oblique) return shift; /* Return zero if not an oblique projection */ |
| 924 | |
| 925 | if (type == GMT_X) { |
| 926 | if (gmt_M_360_range (val, GMT->common.R.wesn_orig[XLO])) val = GMT->common.R.wesn_orig[XLO]; |
| 927 | else if (gmt_M_360_range (val, GMT->common.R.wesn_orig[XHI])) val = GMT->common.R.wesn_orig[XHI]; |
| 928 | if (doubleAlmostEqualZero (val, GMT->common.R.wesn_orig[XLO])) shift = +GMT_CONV4_LIMIT * fabs (GMT->common.R.wesn_orig[XHI] - GMT->common.R.wesn_orig[XLO]); /* Add this to lon to get a slightly larger longitude to ensure crossing */ |
| 929 | else if (doubleAlmostEqualZero (val, GMT->common.R.wesn_orig[XHI])) shift = -GMT_CONV4_LIMIT * fabs (GMT->common.R.wesn_orig[XHI] - GMT->common.R.wesn_orig[XLO]); /* Add this to lon to get a slightly smaller longitude to ensure crossing */ |
| 930 | } |
| 931 | else { |
| 932 | if (doubleAlmostEqualZero (val, GMT->common.R.wesn_orig[YLO])) shift = +GMT_CONV4_LIMIT * fabs (GMT->common.R.wesn_orig[YHI] - GMT->common.R.wesn_orig[YLO]); /* Add this to lon to get a slightly larger longitude to ensure crossing */ |
| 933 | else if (doubleAlmostEqualZero (val, GMT->common.R.wesn_orig[YHI])) shift = -GMT_CONV4_LIMIT * fabs (GMT->common.R.wesn_orig[YHI] - GMT->common.R.wesn_orig[YLO]); /* Add this to lon to get a slightly smaller longitude to ensure crossing */ |
| 934 | |
| 935 | } |
| 936 | if (shift != 0.0) GMT_Report (GMT->parent, GMT_MSG_INFORMATION, "Adjusted argument %g by %g\n", val, shift); |
| 937 | return shift; |
| 938 | } |
| 939 | |
| 940 | /* FANCY RECTANGULAR PROJECTION MAP BOUNDARY */ |
| 941 |
no test coverage detected