I have some polygons and I want to calculate the inner angle of each polygon. Now, I have the geometry of every line of polygons in the same attribute table as shown in the following image.
I want to calculate the inner angle using the following equation:
inner_angle= the bearing angle of the previous line - the bearing angle of the following line +180 (in degrees).
How can I write this in the code block in the model builder and do this for each polygon respectively?
I just need code execute that :
( Can the iterate feature in model builder do this loop ( for each polygon)?)
for each polygon for i = 1: last line in the polygon if i < the last line in the polygon **angle = the line bearing @ i - the line bearing @ (i+1) +180** if angle >360 angle= angle -360 end if angle < 0 angle = angle +360 end else angle = the line bearing @ i - the line bearing @ first line if angle >360 angle= angle -360 end if angle < 0 angle = angle +360 end end end
The desired result as follows: