POV-Ray : Newsgroups : povray.advanced-users : Embarrasing Trig Question : Re: Embarrasing Trig Question Server Time
29 Jul 2024 18:26:51 EDT (-0400)
  Re: Embarrasing Trig Question  
From: Ron Parker
Date: 2 Jul 2001 08:46:42
Message: <slrn9k0r9i.7lp.ron.parker@fwi.com>
On Mon, 02 Jul 2001 01:51:41 +0200, Tor Olav Kristensen wrote:
>
>Ron Parker wrote:
>>...
>> You want atan2(vlength(vcross(A-B,C-B)),vdot(A-B,C-B)).
>
>Yes, that's one way of doing it.
>
>
>He could also try this:
>acos(vdot(vnormalize(A-B),vnormalize(C-B)))
>
>or even:
>asin(vlength(vcross(vnormalize(A-B),vnormalize(C-B))))
>
>But I would suspect POV to parse your expression faster.
>Is this true Ron ?

I suspect they're all about the same in parsing time.  I chose atan2 because
it automatically handles angles beyond pi/2, but that might not be an issue
in this case if you use acos.  asin would have a problem.

-- 
#macro R(L P)sphere{L F}cylinder{L P F}#end#macro P(V)union{R(z+a z)R(-z a-z)R(a
-z*3a+z)torus{1F clipped_by{plane{a 0}}}translate z+V}#end#macro S(g)9-(D-g)*(D-
g)#end#macro Z(D a T F)union{P(a)P(-a)R(y-z-1a)translate.1*D-y*8pigment{rgb<S(7)
S(5)S(3)>}}#if(D)Z(D-.2a,T F)#end#end Z(10x*-2x.2)camera{rotate x*90}


Post a reply to this message

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