Adjust the slider to draw three geometric shapes with the defined number of points. The gray polygons are what you might consider not to be "proper" stars. Read the comments inside for more information.
This started out with me wondering how I could draw a star with as little code as possible, which quickly changed into me wondering how to draw these three shapes (with any number of points) with as little code as possible. My first goal was simple, and requires a minimal amount of math, but my second goal turned out to be surprisingly complicated. I learned a lot making this :) ★★★ Sources ★★★ In the comments inside, I refer to several articles. I will list them here as well for reference. I have intentionally used a variety of sources - try exploring each of them for more info. Degenerate regular star polygons: https://en.wikipedia.org/wiki/Star_polygon#Degenerate_regular_star_polygons Calculating regular polygon side length: https://www.mathopenref.com/polygonsides.html Calculating regular polygon angles: https://en.wikipedia.org/wiki/Regular_polygon#Angles Calculating regular star polygon side length: https://www.mathsisfun.com/algebra/trigonometry.html Polygon density: https://en.wikipedia.org/wiki/Star_polygon https://mathworld.wolfram.com/StarPolygon.html Calculating regular star polygon outline side length: https://www.mathsisfun.com/algebra/trig-solving-aas-triangles.html There are lots and lots of related articles - too many to list here. Just search for "regular polygon", "star polygon", "pentagram", "pentagon", "isosceles triangle", "isotoxal" etc. Thanks to @RobFarley74 for inspiring me to add the compound polygon.