How to calculate the reflex angles of a polygon in the 1st quadrant ?

1 view (last 30 days)
I have a complex polygon in the 1st quadrant. I have all the vertices. I want to measure its internal angles. Some of them are reflex angles. when I use
internal(k) = atan2( abs((x2-x1)*(y3-y1)-(y2-y1)*(x3-x1)),(x2-x1)*(x3-x1)+(y2-y1)*(y3-y1) ) * 180/pi;
it is finding only the angles < pi.
How do I get the reflex angles also (all x and y signs are +ve) ?
Thanks

Answers (1)

Matt J
Matt J on 19 Sep 2015
I don't know how you arrived at your formula, but using abs() in the first argument to atan2 ensures that the result must be between 0 and pi.
atan2(Y,X) must be in [0,pi] whenever Y>=0.

Categories

Find more on Elementary Polygons in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!