Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/sl.barycenter.R

Compute the barycenter of points on a unit sphere. The locations of the three vertices can be provided in x-y-z or lon-lat coordinates. Can be used directly to compute the barycenter (centroid) of a triangle using its vertices, but NOT FOR POLYGONS WITH MORE THAN 3 VERTICES! To that end, use `sl.centroid`

.

1 |

`x` |
a vector of arbitrary length with the x-coordinates of the points on the unit sphere. If specified, |

`y` |
a vector of the same length as |

`z` |
a vector of the same length as |

`lon` |
a vector of arbitrary length with the longitudes of the points. Used only if |

`lat` |
a vector of the same length as |

`weights` |
a vector of the length corresponding to the number of points with optional weights of the points. |

The computation is based on the x-y-z locations of the three vertices. The directly resulting barycenter is located within the unit sphere and projected from the origin back onto the unit sphere.

`lon` |
longitude of the barycenter |

`lat` |
latitude of the barycenter |

Helge Goessling

1 2 3 4 5 6 7 8 9 10 11 12 | ```
## Using x-y-z as input:
sl.barycenter(x=c(1,0,0),y=c(0,1,0),z=c(0,0,1))
## Using lon-lat as input:
sl.barycenter(lon=c(0,90,0),lat=c(0,0,90))
## Both should return:
## $lon
## [1] 45
##
## $lat
## [1] 35.26439
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.