POV-Ray : Newsgroups : povray.newusers : Calculation errors Server Time
22 Jul 2024 00:18:16 EDT (-0400)
  Calculation errors (Message 1 to 4 of 4)  
From: kurtz le pirate
Subject: Calculation errors
Date: 14 Sep 2023 11:23:06
Message: <6503255a$1@news.povray.org>
Hello,

I'm trying to adapt an Excel spreadsheet in POV. I've got a strange problem.

In Excel
Cell E19 = 280.8191102;
Cell E20 = 23.43825611;
Cell E21 = DEGRES ( ATAN2 ( COS(RADIANS(E19));
COS(RADIANS(E20))*SIN(RADIANS(E19) ) ) )

E21 = -78.23396726


In POV
#declare E19 = 280.8191102;
#declare E20 = 23.43825611;
#declare RESULT =degrees(atan2(cos(radians(E19)),
cos(radians(E20))*sin(radians(E19))));

RESULT = 168.233967


No obvious relationship between this -78.2 and +168.2
How to explain this difference ?

Especially since the correct value is -78.2 or 281.7 !
(Note that the numbers after the decimal point are exactly the same.)

Are the origins of angles and rotation direction in Excel and POV
different ?

help apprecied

-- 
Kurtz le pirate
Compagnie de la Banquise


Post a reply to this message

From: Bald Eagle
Subject: Re: Calculation errors
Date: 14 Sep 2023 13:55:00
Message: <web.65034844c7e7348b1f9dae3025979125@news.povray.org>
kurtz le pirate <kur### [at] gmailcom> wrote:
> Hello,
>
> I'm trying to adapt an Excel spreadsheet in POV. I've got a strange problem.

Are you trying to do atan2 like sane people do?
Because the jackasses at Microsoft reversed the arguments.

https://news.povray.org/povray.binaries.images/message/%3C58f61085%40news.povray.org%3E/#%3C58f61085%40news.povray.org%
3E

-BW


Post a reply to this message

From: Droj
Subject: Re: Calculation errors
Date: 14 Sep 2023 14:30:00
Message: <web.65034fd6c7e7348b6848bf7f3b2af915@news.povray.org>
"Bald Eagle" <cre### [at] netscapenet> wrote:
> kurtz le pirate <kur### [at] gmailcom> wrote:
> > Hello,
> >
> > I'm trying to adapt an Excel spreadsheet in POV. I've got a strange problem.
>
> Are you trying to do atan2 like sane people do?
> Because the jackasses at Microsoft reversed the arguments.
>
>
https://news.povray.org/povray.binaries.images/message/%3C58f61085%40news.povray.org%3E/#%3C58f61085%40news.povray.or
g%
> 3E
>
> -BW

Hi BE,

we had a similar problem a while ago with the tube-kind-of-thing:
'the atan2 mystery' and you found the right track.

But see what Povray 3.7 documentation uses:
<< 3.3.1.5.4 Functions
atan2(A,B)
Arc-tangent of (A/B). Returns the angle, measured in radians, whose tangent is
(A/B)....>>

So in your words and accepted by the rest of the world - except Microsoft - it
should read atan2(B,A).

It's always good to have you around.

-Droj


Post a reply to this message

From: kurtz le pirate
Subject: Re: Calculation errors
Date: 15 Sep 2023 02:57:36
Message: <65040060@news.povray.org>
_
          | )
          | |
          | |_____
         /    (]__)
        /    (]___)
       /    (]___)
          ___(]_)
         /
        /
Thanks a lot guys !


Reading the docs we don't pay enough attention to these kinds of details
but it's really jackasses of Microsoft to reverse the arguments.

Microsoft always faithful to its stupidity...



-- 
Kurtz le pirate
Compagnie de la Banquise


Post a reply to this message

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