View source: R/sl.polygon.area.R
| sl.polygon.area | R Documentation |
Compute the area of a polygon on a sphere.
sl.polygon.area(stamp.lon, stamp.lat, ref.lon = NA, ref.lat = NA)
stamp.lon |
a vector specifying the longitudes of the polygon vertices. |
stamp.lat |
a vector specifying the latitudes of the polygon vertices. |
ref.lon |
optionally, a scalar specifying the longitude of the reference point from which the polygon is decomposed into triangles. If not specified, the longitude of the barycenter of the vertices will be used. |
ref.lat |
optionally, a scalar specifying the latitude of the reference point from which the polygon is decomposed into triangles. If not specified, the latitude of the barycenter of the vertices will be used. |
small |
a logical value indicating whether or not to use |
absval |
a logical value indicating whether or not to return an absolute value (consistent with the usual definition of an 'area'; default). If set to |
First the polygon is decomposed into triangles from a reference point. The latter can be specified by the correspoding arguments; otherwise, the barycenter of the polygon vertices will be used. Second the area of each triangle is computed using sl.triag.area or sl.smalltriag.area (depending on the argument small) and multiplied by the triangle's direction of rotation using sl.checkposition. Third the results are summed up.
A scalar giving the area of the poygon (on a unit sphere). If absval=TRUE, the return value is always positive (or zero) as one should expect; otherwise, a positive (negative) return value indicates that the direction of rotation of the polygon is counterclockwise (clockwise).
Helge Goessling
sl.triag.area, sl.smalltriag.area
sl.polygon.area(stamp.lon=c(0,1,1,0),stamp.lat=c(0,0,1,1))
## Should return:
## [1] 0.0003046097
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.