|
![](/i/fill.gif) |
David Fontaine wrote:
...
> I wrote a macro to find the angle between two vectors.
>
> #macro vangle(vec1,vec2)
> #local len1 = vlength(vec1);
> #local len2 = vlength(vec2);
> #local len3 = vlength(vec2-vec1);
> acos((pow(len3,2)-pow(len1,2)-pow(len2,2))/(-2*len1*len2))
> #end
>...
Hello again David
I haven't tested your macro, nor the one below,
but I think this one will do the same job:
#macro VAngle(v1,v2)
acos(vdot(vnormalize(v1), vnormalize(v2)))
#end // macro VAngle
(But maybe you already knew that ;)
--
Best regards,
Tor Olav
mailto:tor### [at] hotmail com
http://hjem.sol.no/t-o-k
http://www.crosswinds.net/~tok
Post a reply to this message
|
![](/i/fill.gif) |