|
![](/i/fill.gif) |
Tor Olav Kristensen wrote:
>
> 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 ;)
I think I tried that too but I had some reason for changing it... maybe
not?
--
David Fontaine <dav### [at] faricy net> ICQ 55354965
My raytracing gallery: http://davidf.faricy.net/
Post a reply to this message
|
![](/i/fill.gif) |