Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Code Snippets / [DBP] - Angle between vectors, cw/ccw

Author
Message
MonoCoder
18
Years of Service
User Offline
Joined: 4th Dec 2005
Location: england
Posted: 26th Aug 2014 12:55 Edited at: 26th Aug 2014 13:11
Given two unit/direction vectors, A and B, this code gives the shortest angular distance from A to B, and whether that is travelling clockwise or counter-clockwise (the orientation, or right- and left-handedness as I've referred to it in the code). Details.



code (requires M1U, Advanced2D plugins)



code (no plugins):



.
Chris Tate
DBPro Master
15
Years of Service
User Offline
Joined: 29th Aug 2008
Location: London, England
Posted: 28th Aug 2014 10:37
Brilliant snippet; very good for calculating the shortest rotation towards a target angle.

Login to post a reply

Server time is: 2024-03-28 19:34:02
Your offset time is: 2024-03-28 19:34:02