vangle() finds the angle between two vectors.
An expression that returns the ange theta between two vectors.
Date Created:Friday December 29th, 2006 03:41 AM
Date Modified:Wednesday July 30th, 2008 02:44 PM
You can emulate this function with the inverse cosine of the dot product of the vectors over the product of their magnitudes.
vangle( vector3 ( point("/obj/model/sphere1",0,P,0), point("/obj/model/sphere1",0,P,1), point("/obj/model/sphere1",0,P,2) ), vector3 ( point("/obj/model/sphere2",0,P,0), point("/obj/model/sphere2",0,P,1), point("/obj/model/sphere2",0,P,2) ) )
Notice that it returns degrees, not radians:
/ -> echo `vangle( vector3(0,0,0), vector3 ( 0,1,0 ))` 90
Please login or Click Here to register for downloads
vangle by Dan Lynch
is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License
Based on a work at www.3daet.com
Permissions beyond the scope of this license may be available at http://www.3daet.com