POV-Ray : Newsgroups : povray.general : Field of View : Re: Field of View Server Time
7 Aug 2024 17:26:32 EDT (-0400)
  Re: Field of View  
From: Tor Olav Kristensen
Date: 5 Aug 2001 21:10:15
Message: <3B6DED7D.EC8AAB9A@hotmail.com>
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] hotmailcom
http://hjem.sol.no/t-o-k
http://www.crosswinds.net/~tok


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.