# rhxrh

Intersection points for pairs of rhumb lines

## Syntax

```[newlat,newlong] = rhxrh(lat1,lon1,az1,lat2,lon2,az2) [newlat,newlon] = rhxrh(lat1,lon1,az1,lat2,lon2,az2,units) ```

## Description

`[newlat,newlong] = rhxrh(lat1,lon1,az1,lat2,lon2,az2)` returns in `newlat` and `newlon` the location of the intersection point for each pair of rhumb lines input in rhumb line notation. For example, the first line in the pair passes through the point (`lat1`,`lon1`) and has a constant azimuth of `az1`. When the two rhumb lines are identical or do not intersect (conditions that are not, in general, apparent by inspection), two `NaN`s are returned instead and a warning is displayed. The inputs must be column vectors.

`[newlat,newlon] = rhxrh(lat1,lon1,az1,lat2,lon2,az2,units)` specifies the units used, where units is any valid `units`. The default units are `'degrees'`.

For any pair of rhumb lines, there are three possible intersection conditions: the lines are identical, they intersect once, or they do not intersect at all (except at the poles, where all nonequatorial rhumb lines meet—this is not considered an intersection). `rhxrh` does not allow multiple rhumb line intersections, although it is possible to construct cases in which such a condition occurs. See the following discussion of Limitations.

Rhumb line notation consists of a point on the line and the constant azimuth of the line.

## Examples

collapse all

Given a starting point at (10ºN,56ºW), a plane maintains a constant heading of 35º. Another plane starts at (0º,10ºW) and proceeds at a constant heading of 310º (–50º). Where would their two paths cross each other?

Calculate Point of Intersection

Use the `rhxrh` function to calculate the point of intersection of two paths.

`[newlat,newlon] = rhxrh(10,-56,35,0,-10,310)`
```newlat = 26.9774 ```
```newlon = -43.4088 ```

## Limitations

Rhumb lines are specifically helpful in navigation because they represent lines of constant heading, whereas great circles have, in general, continuously changing heading. In fact, the Mercator projection was originally designed so that rhumb lines plot as straight lines, which facilitates both manual plotting with a straightedge and numerical calculations using a Cartesian planar representation. When a rhumb line proceeds off the left or right edge of this representation at some latitude, it reappears on the other edge at the same latitude and continues on the same slope. For rhumb lines where this occurs—for example, one with a heading of 85º—it is easy to imagine another rhumb line, say one with a heading of 0º, repeatedly intersecting the first. The real-world uses of rhumb lines make this merely an intellectual exercise, however, for in practice it is always clear which crossing line segment is relevant. The function `rhxrh` returns at most one intersection, selecting in each case that line segment containing the input starting point for its computation.

## Version History

Introduced before R2006a