POV-Ray : Newsgroups : povray.advanced-users : Embarrasing Trig Question : Re: Embarrasing Trig Question Server Time
29 Jul 2024 18:18:10 EDT (-0400)
  Re: Embarrasing Trig Question  
From: Tor Olav Kristensen
Date: 3 Jul 2001 12:29:47
Message: <3B41F328.815FC204@hotmail.com>
Ron Parker wrote:
> 
> 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.

I see.

I'm so used to doing it the acos way 
that I didn't give the input ranges 
any thoughts when I posted my last 
message.

Of course; The asin wouldn't be able
to discriminate between vectors having
an angle Theta between them and vectors
having an angle pi-Theta between them.


-- 
Tor Olav Kristensen
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.