subtraction of angles

About advanced scenes, and the Thyme scripting language used in Algodoo.

subtraction of angles

Postby Kilinich » Wed Oct 06, 2010 9:48 pm

Simple code to subtract two angles (and fit it in -pi +pi range).

Code: Select all
scene.my.aSub = (a, b)=>{c := (a-b)%(2*math.pi); c > math.pi ? {c - 2*math.pi}:{c < - math.pi ? c+2*math.pi : c}}


btw you need to do same with sum...
Dream of Algodoo as game development engine...
User avatar
Kilinich
[Best bug reporter 2010]
 
Posts: 2098
Joined: Mon Aug 31, 2009 8:27 pm
Location: South Russia

Return to Thyme scripting

Who is online

Users browsing this forum: No registered users and 5 guests