POV-Ray : Newsgroups : povray.general : Proposed VAngle alternative AngleBetweenVectors. (Attn: Tor Olav) : Re: Proposed VAngle alternative AngleBetweenVectors. (Attn: Tor Olav) Server Time
19 Apr 2024 20:51:43 EDT (-0400)
  Re: Proposed VAngle alternative AngleBetweenVectors. (Attn: Tor Olav)  
From: clipka
Date: 26 May 2021 17:41:31
Message: <60aec08b@news.povray.org>
Am 13.05.2021 um 21:35 schrieb William F Pokorny:

> Ans: It turns out the parser version of acos tests the inputs, clamps if 
> need be and issues a warning on each bad-domain call. This means any 
> math.inc clamping is really there to suppress the warning messages.
> 
> Why not a parse error over a warning is a good question - given warnings 
> can be ignored. It would be better for the user to learn and correct code.

I don't entirely agree.

There is a long-standing tradition that POV-Ray does not abandon parsing 
of a scene file if there's a sensible way to deal with the situation.

There are plenty of conceivable cases where the result of some 
computation should mathematically be within valid range for `acos`, but 
due to a numerical precision issue is actually not. Leaving it up to the 
user to protect against such issues would effectively mean that they'd 
have to safeguard pretty much each and every invocation of `acos` in 
such a way, which costs tons of time when done in POV-Ray's scene 
description language, compared to hard-coding such a mechanism into the 
`acos` function itself.

It could be argued that it would make sense to issue an error instead of 
a warning if the argument is out of range by more than just a bit. But 
for just barely out of range arguments, issuing a warning is the maximum 
POV-Ray should do about it.


And then there's also the long-standing tradition of not breaking 
existing scenes unless it can't be avoided. If we change the warning 
into a hard error, I guess there _will_ be legacy scenes broken. If we 
do this even for "minor infractions", breakage of legacy scenes is very 
much guaranteed.


Post a reply to this message

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