Reputation: 4288
Given two lines of common origin point, whose rotational angles I have in degrees, what's the best way in Lua to calculate the reflex and obtuse angles involved?
Upvotes: 0
Views: 266
Reputation: 2454
Assuming that you want the reflex angle that complements the obtuse angle, and don't worry about getting values of 90 or 180 degrees for the obtuse value:
function obtuse_reflex(a, b) local diff = (a - b) % 180 if diff < 90 then diff = 180 - diff end return diff, 360 - diff end
Upvotes: 2