Description Usage Arguments Value Author(s) Examples
View source: R/compute-polygon-area.R
This function takes in a data frame containing one or more polygons, and computes the (signed) area of each polygon.
1 | compute_polygon_area(vertex.df, signed = FALSE)
|
vertex.df |
A data frame where each row corresponds to the vertex of a polygon.
It must contain the columns |
signed |
If true, the signed areas of the polygons are returned (positive for counter-clockwise oriented polygons, negative for clockwise oriented.) |
A data frame that contains two columns:
group |
The group number of the polygon |
area |
The area of the polygon |
Mathias Isaksen mathiasleanderi@gmail.com
1 2 3 4 5 6 7 8 9 10 | # Example with multiple polygons
vertex.df = compute_regular_polygons(
center = data.frame(x = c(0, 10), y = c(0, 0)),
radius = 1,
num.edges = c(4, 1000)
)
area.df = compute_polygon_area(vertex.df)
# Note that the area of polygon 2 is close to pi!
print(area.df)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.