Documentation

# rotatem

Transform vector map data to new origin and orientation

## Syntax

```[lat1,lon1] = rotatem(lat,lon,origin,'forward') [lat1,lon1] = rotatem(lat,lon,origin,'inverse') [lat1,lon1] = rotatem(lat,lon,origin,'forward',units) [lat1,lon1] = rotatem(lat,lon,origin,'forward',units) ```

## Description

`[lat1,lon1] = rotatem(lat,lon,origin,'forward')` transforms latitude and longitude data (`lat` and `lon`) to their new coordinates (`lat1` and `lon1`) in a coordinate system resulting from Euler angle rotations as specified by `origin`. The input `origin` is a three- (or two-) element vector having the form ```[latitude longitude orientation]```. The latitude and longitude are the coordinates of the point in the original system, which is the center of the output system. The orientation is the azimuth from the new origin point to the original North Pole in the new system. If `origin` has only two elements, the orientation is assumed to be 0º. This `origin` vector might be the output of `putpole` or `newpole`.

`[lat1,lon1] = rotatem(lat,lon,origin,'inverse')` transforms latitude and longitude data (`lat` and `lon`) in a coordinate system that has been transformed by Euler angle rotations specified by `origin` to their coordinates (`lat1` and `lon1`) in the coordinate system from which they were originally transformed. In a sense, this undoes the `'forward'` process. Be warned, however, that if data is rotated forward and then inverted, the final data might not be identical to the original. This is because of roundoff and data collapse at the original and intermediate singularities (the poles).

`[lat1,lon1] = rotatem(lat,lon,origin,'forward',units)` and ```[lat1,lon1] = rotatem(lat,lon,origin,'forward',units)``` specify the angle units of the data, where `units` is any recognized angle unit. The default is `'radians'`. Note that this default is different from that of most functions.

The `rotatem` function transforms vector map data to a new coordinate system.

An analytical use of the new data can be realized in conjunction with the `newpole` function. If a selected point is made the north pole of the new system, then when new vector data is created with `rotatem`, the distance of every data point from this new north pole is its new colatitude (90º minus latitude). The absolute difference in the great circle azimuths between every pair of points from their new pole is the same as the difference in their new longitudes.

## Examples

What are the coordinates of Rio de Janeiro (23ºS,43ºW) in a coordinate system in which New York (41ºN,74ºW) is made the North Pole? Use the `newpole` function to get the origin vector associated with putting New York at the pole:

```nylat = 41; nylon = -74; riolat = -23; riolon = -43; origin = newpole(nylat,nylon); [riolat1,riolon1] = rotatem(riolat,riolon,origin,... 'forward','degrees') riolat1 = 19.8247 riolon1 = -149.7375 ```

What does this mean? For one thing, the colatitude of Rio in this new system is its distance from New York. Compare the distance between the original points and the new colatitude:

```dist = distance(nylat,nylon,riolat,riolon) dist = 70.1753 90-riolat1 ans = 70.1753 ```
{"ft_lang_label":"__label__en","ft_lang_prob":0.7734501,"math_prob":0.96878624,"size":3052,"snap":"2019-51-2020-05","text_gpt3_token_len":815,"char_repetition_ratio":0.1476378,"word_repetition_ratio":0.042918455,"special_character_ratio":0.24475753,"punctuation_ratio":0.153457,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9777759,"pos_list":[0,1,2],"im_url_duplicate_count":[null,null,null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2020-01-18T13:28:29Z\",\"WARC-Record-ID\":\"<urn:uuid:a8dff374-8ce9-4822-9cf3-9364b5484ba0>\",\"Content-Length\":\"66877\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:97479d08-c4c5-4dc6-9754-cf1c63cc43f5>\",\"WARC-Concurrent-To\":\"<urn:uuid:5d1f128e-afae-4139-a950-a8449312d600>\",\"WARC-IP-Address\":\"104.110.193.39\",\"WARC-Target-URI\":\"https://www.mathworks.com/help/map/ref/rotatem.html\",\"WARC-Payload-Digest\":\"sha1:OS63BDTULUKOMKPZ36GIUS3YXKONP5AN\",\"WARC-Block-Digest\":\"sha1:LGHLYDPDTGFJ7OCOD2YQC3RM22LSDODP\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2020/CC-MAIN-2020-05/CC-MAIN-2020-05_segments_1579250592565.2_warc_CC-MAIN-20200118110141-20200118134141-00459.warc.gz\"}"}