powered by
Calculate the vertices of a regular polygon given the number of sides and its radius (distance from center to vertex). Also permits transforming the resulting coordinates by moving the origin and altering the initial angle
PolyVtx(n, r = 1L, xc = 0L, yc = 0L, t1 = 0)
A data.frame with n rows and two columns:
data.frame
n
x
X positions of each coordinate
y
Y positions of each coordinate
Number of sides of the polygon
Radius of the polygon
X/Y coordinates for the center of the polygon
Angle of the first vertex in degrees
https://stackoverflow.com/questions/3436453/calculate-coordinates-of-a-regular-polygons-vertices
Angles
(coords <- PolyVtx(5, t1 = 90)) if (requireNamespace("ggplot2", quietly = TRUE)) { ggplot2::ggplot(coords, ggplot2::aes(x = x, y = y)) + ggplot2::geom_polygon() }
Run the code above in your browser using DataLab