Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

I have 5 points and measures of sides of pentagon in 2D. Then how do i find interior angles of pentagon?

Suppose $P_1,P_2,P_3,P_4,P_5$ are five points of Pentagon $P_1P_2P_3P_4P_5$. I know how to find angle of triangle giving sides using cosine formula.To find angle at $P2$, i have made one triangle $P_1P_2P_3$ and also rest of angles have same process. It is fine. But When i move a point to inside of pentagon the angle at some point will be exterior angle. Exactly i want to find interior angles. Please help me any one.

share|improve this question
1  
You can use dot product to find angles. en.wikipedia.org/wiki/Dot_product –  Mathlover May 26 '12 at 7:10
    
@PrasadG Do you only know the lengths of the sides, or are you given coordinates of the five points? In the latter case see Mathlovers comment –  Bernhard May 26 '12 at 7:33
4  
and if you only know the lengths of the sides, this isn't enough to determine the angles. –  user22805 May 26 '12 at 8:01
    
I don't understand "When I move points to form pentagon the angle at some point will be exterior angle." What do you mean? –  Gerry Myerson May 29 '12 at 12:32
    
I can find angles for convex pentagon but not concave pentagon. I asked for second case. when i move a point to inside of pentagon, the angle at that point will be shown exterior angle. Actually the angle will increase(>180 degrees) when move a point to inside of pentagon. But it's not like that. It will be shown less than 180 degrees. –  Prasad G May 29 '12 at 12:40

1 Answer 1

up vote 4 down vote accepted

If you have the points then that's all you need. Use the dot product between two sides, going in the same direction along both. So if you want the angle $\angle P_1P_2P_3$, you can do $$\pi-\arccos(\frac{(P_2-P_1)\cdot(P_3-P_2)}{|P_2-P_1||P_3-P_2|})$$

But this only works for acute angles, as you've seen. So:


If you can see which angles are acute and which aren't, just take $2\pi$ minus the above answer for the reflex angles.


If you need a computer algorithm: don't store the angles as you go, store the signed $\arccos()$ values directly. These are the difference in direction between sides (exterior angles in a convex polygon). Sign them by giving them a third $z$-coordinate of $0$, and computing the cross product $(P_2-P_1)\times (P_3-P_2)$. You'll get one non-zero value along the '$z$' direction. If it's negative, you're turning right. If it's positive, you're turning left. Give the $\arccos()$ values the sign of their corresponding cross-products. Start off by assuming the polygon is on your left. Use this assumption, the above calculation, and the cross product to compute those signed $\arccos()$ values. Also keep a running total of the angle you've turned: what we're looking for is something like the winding number. If your total angle traversed at the end is $2\pi$, then your assumption that the polygon was on your left was correct, and your angles are $\pi$ minus the values you stored. If your total angle traversed is $-2\pi$, then your assumption was wrong, and you should take $\pi$ plus the values you stored instead.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.