Mapping Toolbox | ![]() ![]() |
Vector Calculations - Intersections
The Mapping Toolbox provides a set of functions to perform intersection calculations on vector data computed by the toolbox, which include great and small circles, as well as rhumb line tracks. The functions also determine intersections of arbitrary vector data.
Compute the intersection of a small circle centered at (0°,0°) with a radius of 1250 nautical miles and a small circle centered at (5°N,30°E) with a radius of 2500 kilometers:
[lat,long] = scxsc(0,0,nm2deg(1250),5,30,km2deg(2500)) lat = 17.7487 -12.9839 long = 11.0624 16.4170
Notice that, in general, small circles intersect twice or never. For the case of exact tangency, scxsc
returns two identical intersection points. Other similar commands include rhxrh
for intersecting rhumb lines, gcxgc
for intersecting great circles, and gcxsc
for intersecting a great circle with a small circle.
Imagine a ship setting sail from Norfolk, Virginia (37°N,76°W), maintaining a steady due-east course (90°), and another ship setting sail from Dakar, Senegal (15°N,17°W), with a steady northwest course (315°). Where would the tracks of the two vessels cross?
The intersection of the tracks is at (37°N,41.7°W), which is roughly 600 nautical miles west of the Azores in the Atlantic Ocean.
You can also compute the intersection points of arbitrary vectors of latitude and longitude. The polyxpoly
command finds the segments that intersect and interpolates to find the intersection points. The interpolation is done linearly, as if the points were in a cartesian x-y coordinate system. The polyxpoly
command can also identify the line segment numbers associated with the intersections:
If the spacing between points is large, there may be some difference between the intersection points computed by polyxpoly
and the intersections shown on a map display. This is a result of the difference between straight lines in the unprojected and projected coordinates. Similarly, there may be differences between the polyxpoly
result and intersections assuming great circle or rhumb lines between points.
![]() | Polygon Area | Polygon Boolean Operations | ![]() |