I am writing a software function to plot the outer points of an n-sided polygon and I'm having trouble ensuring I use the correct terminology. The function I've written simply renders the calculated points of a predetermined polygon in two dimensional space. These polygons are neither convex nor concave and thus I believe the name I should give the function is Render Uniform Polygon; however, I believe uniform may not be the correct word and could end up in a debate over the name. The function itself performs three actions to achieve the goal:
- Calculate the angle of each point $\theta_n$.
- Calculate the new position $P_n$.
- Render a 3px by 3px dot at the new position.
The math for calculating $\theta_n$ is:
$$\theta_n = \frac{\biggl(\bigl(\frac{360°}{p}\bigr)n + \phi\biggr)\pi}{180°}$$
Where:
- $p$ is the number of points in the polygon.
- $n$ is the current point.
- $\phi$ is the global rotation angle.
Once $\theta_n$ has been calculated with the math above, I then use it to calculate the new position with the following:
$$P_{_n{x, y}} = C_{x, y} + (\cos(\theta_n), \sin(\theta_n))r$$
Where:
- $P_n$ is current point's position.
- $C_{x, y}$ is the center of the polygon.
- $r$ is the radius of the polygon.
This method can be used to render any polygon with three sides or more, and since the radius is predefined there isn't a case where the polygon can be convex or concave.
What is a polygon that is neither convex nor concave called?
construct_polygon()
method is a fine name for that. $\endgroup$