POV-Ray : Newsgroups : povray.advanced-users : What... the hell...? : Re: What... the hell...? Server Time
28 Jul 2024 10:22:40 EDT (-0400)
  Re: What... the hell...?  
From: Orchid XP v2
Date: 20 Mar 2006 07:31:55
Message: <441ea0bb@news.povray.org>
>>"atan2(A,B): Arc-tangent of (A/B). Returns the angle, measured in 
>>radians, whose tangent is (A/B). Returns appropriate value even if B is 
>>zero. Use atan2(A,1) to compute usual atan(A) function."
> 
> 
>>Um... yeah, OK... so why does atan2(0, 0) give we a fatal parse error?
> 
> 
>   Because the result is not defined. You are basically asking the
> direction of a zero vector, which has none.

I just thought the whole point of using atan2 was to _avoid_ divide by 
zero errors.

Sure, if the vector has a length of zero it has no defined direction. 
OTOH, I would imagine in most cases it just wouldn't *matter* what 
number the function returns in this case - just so long as it returns 
something, rather than an error...

Oh well.


Post a reply to this message

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