0
$\begingroup$

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:

  1. Calculate the angle of each point $\theta_n$.
  2. Calculate the new position $P_n$.
  3. 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?

$\endgroup$
5
  • 1
    $\begingroup$ All regular polygons are convex. As far as I know, a polygon that is neither convex nor concave is called "neither convex nor concave". I don't know of any special term for that. $\endgroup$ Jan 21, 2019 at 18:22
  • $\begingroup$ @AdrianKeister So simply Render Polygon should suffice in this case without causing any confusion? $\endgroup$ Jan 21, 2019 at 18:23
  • 1
    $\begingroup$ Sure! A regular polygon is a polygon, but not the reverse. So if you happen to be constructing regular polygons, a construct_polygon() method is a fine name for that. $\endgroup$ Jan 21, 2019 at 18:25
  • 2
    $\begingroup$ For me, a concave polygon is one that has at least one angle greater than $\pi$ and a convex one has no angles greater than $\pi$. In that case there are no polygons that are neither concave nor convex. $\endgroup$ Jan 21, 2019 at 18:25
  • $\begingroup$ @RossMillikan: Excellent point, I agree! $\endgroup$ Jan 21, 2019 at 18:26

1 Answer 1

2
$\begingroup$

As far as I can see your polygon is convex. It's a regular polygon whose vertices are equidistant on the circle with radius $r$ and center $C$.

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .