计算反射和钝角

时间:2011-03-03 14:41:57

标签: math lua

给定两条共同原点,其旋转角度为度数,Lua计算反射和钝角的最佳方法是什么?

1 个答案:

答案 0 :(得分:2)

假设您希望反射角度与钝角成反映,并且不必担心钝角值的值为90或180度:

function obtuse_reflex(a, b)
  local diff = (a - b) % 180
  if diff < 90 then diff = 180 - diff end
  return diff, 360 - diff
end