Le 2021-10-18 à 11:42, kurtz le pirate a écrit :
> On 17/10/2021 23:46, Cousin Ricky wrote:
>> ... Of course, the inverse tangent of A/0 is undefined, because A/0 is
>> undefined. But a simple limits exercise, as well as the very definition
>> of the tangent of an angle, show that these undefined tangents
>> correspond to the angles pi/2 and -pi/2, and it is therefore useful to
>> pretend that they are valid.
>> The purpose of atan2() is to handle these special cases, by converting a
>> naive atan()'s argument into an ordered pair, thus allowing the would-be
>> inverse tangent of A/0 to be computed without having to divide by 0. A
>> simple scene file shows that the *only* time atan2() fails with a domain
>> error is when *both* A and B are zero. Of course, (0, 0) is an
>> indeterminate case, for which returning a value would be nonsensical.
> Cousin Ricky is right about everything!
> And therefore, my problem is when A AND B are equal to zero.
> Lot of datas to deal with, the debugging will be long...
> (i'm working on the visualization of complex functions with domain
Add a test to see if both A and B are zero, and replace that with some
small value for B. It could be something like the following just before
the call to atan2 :
#if (A=0 ! B=0) #declare B= 0.001; #end
... atan2(A,B) ...
Post a reply to this message