star_scale() computes star scale value given an internal or external angle. star_angle() computes star angle (internal or external) given a scale value.

star_scale(n_vertices, angle, external = FALSE)

star_angle(n_vertices, scale, external = FALSE)



Number of exterior vertices.


Angle in degrees.


If TRUE angle should be considered an external angle.


Scale from 0 to 1.


star_scale() returns a numeric value between 0 and 1 intended for use as the scale argument in grid.pattern_regular_polygon(). star_angle() returns a numeric value between 0 and 360 (degrees).


grid.pattern_regular_polygon() parameterizes regular star polygons with the number of its external vertices and a scale that equals the fraction of the radius of the circle that circumscribes the interior vertices divided by the radius of the circle that circumscribes the exterior vertices. These helper functions help convert between that parameterization and either the internal or external angle of the regular star polygon.


# |8/3| star has internal angle 45 degrees and external angle 90 degrees scale <- star_scale(8, 45) scale2 <- star_scale(8, 90, external = TRUE) all.equal(scale, scale2)
#> [1] TRUE
star_angle(8, scale)
#> [1] 45
star_angle(8, scale, external = TRUE)
#> [1] 90
if (require("grid")) { grid.pattern_regular_polygon(shape = "star8", scale = scale, angle = 0, spacing = 0.2, density = 0.8) }