I notice that the function ATAN2() does not appear in documentation, but it's declared in code. Is there a particular reason this function is missing, or am I misunderstanding the source?
https://github.com/Lexikos/AutoHotkey_L/blob/master/source/qmath.h#L568
Atan2 in code but not documented nor exposed? Topic is solved
Re: Atan2 in code but not documented nor exposed?
You misunderstand. there's probably a thousand functions in the source, I don't think you'd expect them to be available in script.
Cheers.
Cheers.
Re: Atan2 in code but not documented nor exposed?
Here's a slow version for anyone who needs it.
Code: Select all
atan2(y,x) { ; y then x
if (x > 0)
return atan(y/x)
if (x < 0) ; && (y <> 0)
return atan(y/x) + 3.1415926535898 * ((y >= 0) ? 1.0 : -1.0)
if (y <> 0) ; && (x = 0)
return 1.5707963267949 * ((y >= 0) ? 1.0 : -1.0)
return 0.0
} ; by Raccoon 2019
Re: Atan2 in code but not documented nor exposed?
what would ATAN2 be? or what is ATAN2() ?
Re: Atan2 in code but not documented nor exposed?
https://en.wikipedia.org/wiki/Atan2
I thought you were an IBM and Fortran guy...
(Ok, there were other use cases for these, too )
Re: Atan2 in code but not documented nor exposed?
Code: Select all
atan2(y, x) {
return dllcall("msvcrt\atan2", "Double", y, "Double", x, "CDECL Double")
}
Re: Atan2 in code but not documented nor exposed?
Thanks guys. I did write fortran. In 1967! But, that was just in high school. I never know what quadrant I'm in.
Re: Atan2 in code but not documented nor exposed?
- I suggested that it be made a function, here was an attempt at some C++ code.
C++: AHK source code: potential functions - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=23&t=54392
- In general, there are various ideas that could very easily be added as built-in functions, e.g. re. maths and dates, because the libraries or custom code is already present in the AHK source code. So it's a case of people noticing the existing code and proposing the new functions.
C++: AHK source code: potential functions - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=23&t=54392
- In general, there are various ideas that could very easily be added as built-in functions, e.g. re. maths and dates, because the libraries or custom code is already present in the AHK source code. So it's a case of people noticing the existing code and proposing the new functions.
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
Re: Atan2 in code but not documented nor exposed? Topic is solved
Hallo,
or:
Edit, this also works on the axes:
or:
Code: Select all
atan2(y,x) {
Return atan(y/x)+4*atan((x<0)*((y>0)-(y<0)))
}
Code: Select all
atan2(y,x) {
Return atan(y/x)+2*(1+(x<0))*atan((x<=0)*((y>=0)-(y<0)))
}
Last edited by Rohwedder on 04 Mar 2019, 06:58, edited 1 time in total.
Re: Atan2 in code but not documented nor exposed?
Very nice, Rohwedder. Quite clever!
Who is online
Users browsing this forum: Google [Bot], LeafyWater and 172 guests