POV-Ray : Newsgroups : povray.advanced-users : Why the min() step in angle between two vectors? : Re: Why the min() step in angle between two vectors? Server Time
29 Jul 2024 12:19:30 EDT (-0400)
  Re: Why the min() step in angle between two vectors?  
From: Peter Popov
Date: 26 Mar 2002 12:33:47
Message: <tkb1aucncrofl902c215md067i22ighvbr@4ax.com>
On Tue, 26 Mar 2002 10:40:41 -0600, "Shay" <sah### [at] simcopartscom> wrote:

>Povray finds the angle between two vectors like this like this: acos(min(1,
>vdot(vnormalize(V1), vnormalize(V2)))) What is the purpose of the min()?

acos is defined over [-1; 1] because no angle has a cosine greater
than 1. However, with computers, it is perfectly normal to have as a
result something like 1.0000000098345352 when you need 1, which, in
this case, will trigger a floating point exception. Hence the min.


Peter Popov ICQ : 15002700
Personal e-mail : pet### [at] vipbg
TAG      e-mail : pet### [at] tagpovrayorg


Post a reply to this message

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