POV-Ray : Newsgroups : povray.advanced-users : What... the hell...? : Re: What... the hell...? Server Time
28 Jul 2024 10:28:53 EDT (-0400)
  Re: What... the hell...?  
From: Ken and Timi Cecka
Date: 11 Mar 2006 17:04:00
Message: <44134950@news.povray.org>
Orchid XP v2 wrote:

> 3.2.1.3.4  Functions
> 
> "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?
> 
> (POV-Ray v3.6, Windows.)

The arguments to atan2 are the rise (A) and run (B) of a tangent line for
which you want to know the angle.  If the line runs (B != 0) but does not
rise (A = 0), you have a horizontal line.  If the line rises (A != 0) but
does not run (B = 0), you have a vertical line.  But if the line does not
rise (A = 0) or run (B = 0), what do you have?  The line does not go
anywhere, so the angle is undefined.

I haven't looked at the pov code, but I expect this is the reason for the
parse error - there's no correct way to evaluate the expression.

Ken


Post a reply to this message

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