Averaging angles

后端 未结 4 594
执笔经年
执笔经年 2020-12-19 15:12

I looked at some solutions here but none provide what I need, so:

I need to average an array of angles(0 to 359.9, no negatives) (A1 + A2 + A3 + An) / n

The

4条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-19 15:47

    Do you want to round it off i.e. 0 should come after 359 degree?

    take a modulus of the result with 360.

    avg = ( (a1 + a2 + an) /n ) % 360
    

提交回复
热议问题