Is angle in between two angles

前端 未结 4 1410
一整个雨季
一整个雨季 2020-12-20 07:08

I have 3 angles a b c

a=315 b=20 c=45

ok so would like to know giving all three if b is in between a and c

i have the long way of doing this adding a

4条回答
  •  暖寄归人
    2020-12-20 07:37

    Assuming a > c, you would actually use:

    ( b < a ) && ( b > c )
    

    This is the same as checking if a value is between a lower and upper bound. Them being angles makes no difference, unless you want to take into account the fact that as you go round a circle, an angle of 405 is the same as an angle of 45. In which case you can just use a % 360 to get the angle betweeen 0 and 360.

提交回复
热议问题