Return positions for equilateral polygon vertices

pos_polygon(x0 = 0, y0 = 0, n = 5, radius = 1, rotation = -0.5)

Arguments

x0

numeric x center of shape, defaults to 0

y0

numeric y center of shape, defaults to 0

n

number of positions

radius

a numeric value, the distance between x0 and y0 and the vertices

rotation

numeric indicating how much polygon should be turned from first vertex along positive horizontal

Value

Examples

pos_polygon()
#> x0 y0 #> 1 6.123234e-17 1.000000 #> 2 9.510565e-01 0.309017 #> 3 5.877853e-01 -0.809017 #> 4 -5.877853e-01 -0.809017 #> 5 -9.510565e-01 0.309017
pos_polygon(n = 10)
#> x0 y0 #> 1 6.123234e-17 1.000000 #> 2 5.877853e-01 0.809017 #> 3 9.510565e-01 0.309017 #> 4 9.510565e-01 -0.309017 #> 5 5.877853e-01 -0.809017 #> 6 6.123234e-17 -1.000000 #> 7 -5.877853e-01 -0.809017 #> 8 -9.510565e-01 -0.309017 #> 9 -9.510565e-01 0.309017 #> 10 -5.877853e-01 0.809017
# Using w plotspace ggcanvas() + stamp_label(label = c("hi", "bye", "tchao"), xy = pos_polygon(n = 3, rotation = -.5, radius = .5))