Finding 2D Polygon Coordinates from a point

In summary, the equation to create a polygon with $n$ sides is: x + r \cos(2\pi \cdot k/n) y + r\sin(2\pi \cdot k/n) where $k$ runs from $0$ to $n-1$.
  • #1
Krotus
2
0
Suppose that I have the coordinates of x and y on a plane.

I am writing a piece of software where the user can select a polygon of 3, 4, 5, 6 or 8 sides. All of the polygon points are equidistant from the x, y point. In other words, if you drew a circle where the center was the x, y point, all of the points of the polygon would line on the circle.

That means, obviously, that the distance of each polygon point is equal to the imaginary circle's radius.

Given that information, what are the equations to create each type of polygon's set of points?
 
Mathematics news on Phys.org
  • #2
Krotus said:
Suppose that I have the coordinates of x and y on a plane.

I am writing a piece of software where the user can select a polygon of 3, 4, 5, 6 or 8 sides. All of the polygon points are equidistant from the x, y point. In other words, if you drew a circle where the center was the x, y point, all of the points of the polygon would line on the circle.

That means, obviously, that the distance of each polygon point is equal to the imaginary circle's radius.

Given that information, what are the equations to create each type of polygon's set of points?

Hi Krotus, welcome to MHB!

Suppose the polygon will have $n$ sides.
And suppose each of the polygon points must have a distance of $r$ to point $(x,y)$.
Then the x- and y-coordinates of point $k$ of the polygon are given by:
$$\begin{cases}x + r \cos(2\pi \cdot k/n) \\ y + r\sin(2\pi \cdot k/n)\end{cases}$$
where $k$ runs from $0$ to $n-1$. Furthermore, the first point ($k=0$) will be to the right of $(x,y)$.

If you want the first point to be in a different location than to the right of $(x,y)$, we can add a fixed constant to the calls of $\cos$ and $\sin$.
 
  • #3
Thanks! Very simple. I knew I had to be overthinking it.
 

1. How do you find the coordinates of a point on a 2D polygon?

To find the coordinates of a point on a 2D polygon, you must first identify the specific polygon you are working with. Then, you can use the formula x = x0 + r*cos(θ) and y = y0 + r*sin(θ), where x0 and y0 are the coordinates of the center of the polygon, r is the distance from the center to the point, and θ is the angle between the center and the point. This will give you the coordinates of the point on the polygon.

2. What is the center of a 2D polygon?

The center of a 2D polygon is the point that is equidistant from all of the vertices of the polygon. It is often denoted as (x0, y0) and can be used as a reference point for finding the coordinates of other points on the polygon.

3. Can you find the coordinates of a point on a 2D polygon without knowing the center?

Yes, it is possible to find the coordinates of a point on a 2D polygon without knowing the center. You can use the distance formula d = √((x2 - x1)2 + (y2 - y1)2) to find the distance between the point and each vertex of the polygon. Then, you can use trigonometric functions to calculate the angle between the point and each vertex, and use the formulas mentioned in the first question to find the coordinates of the point.

4. How do you determine the angle between a point and the center of a 2D polygon?

The angle between a point and the center of a 2D polygon can be determined by using the inverse tangent function, arctan(y/x). This will give you the angle in radians. If you need the angle in degrees, you can convert it by multiplying by 180/π.

5. Are there any shortcuts or alternative methods for finding 2D polygon coordinates from a point?

Yes, there are some shortcuts or alternative methods for finding 2D polygon coordinates from a point. One method is to use vector cross products, where you can calculate the cross product of the vectors formed by the point and two adjacent vertices of the polygon. This will give you the area of the triangle formed by those three points, and you can use that to find the coordinates of the point. Another method is to use the centroid of the polygon, which is the average of all the x and y coordinates of the vertices. From there, you can use the distance formula and trigonometric functions to find the coordinates of the point.

Similar threads

Replies
6
Views
745
  • General Math
Replies
6
Views
944
  • Calculus and Beyond Homework Help
Replies
4
Views
2K
Replies
2
Views
1K
  • General Math
Replies
3
Views
2K
Replies
1
Views
1K
  • General Math
Replies
2
Views
1K
Replies
2
Views
822
Replies
13
Views
3K
Back
Top