Description
Expected Behaviour
When moving to zenith or nadir (±90° altitude) in Search window : Position : Horizontal, azimuth is expected to be unchanged in main view and Search window.
Actual Behaviour
When moving to abs(altitude) > arcsin(0.99) ≈ 81.890386° in Search window : Position : Horizontal, azimuth jumps to some other value in main view but is unchanged and thereby faulty in Search window.
Steps to reproduce
Set FOV to 180°, enter e.g. 0°, 90°, 180° or 270° in Search window : Position : Horizontal, azimuth field and then e.g. 85° in altitude field, and see the view and cardinal points suddenly jump to unexpected directions after the initial correct rotation (cardinal points N S E W should be and stay up down right left).
System
- Stellarium version: Stellarium 23.3
- Operating system: macOS Ventura 13.4.1.
- Graphics Card: Apple M1 Max (Metal 3, MacBookPro18,2)
- Screen type (if applicable): Liquid Retina XDR, 3456 x 2234, scaling 1:2
Comment
The cause is most probably
stellarium/src/core/StelMovementMgr.cpp line 1151 in Stellarium 23.3:
if (fabs((fabs(viewDirectionMountFrame.v[2]) - 1.)) < 0.01 )
Introduced in PR #2659 2022-09-18
Not a problem in Stellarium 0.19.1.
The above causes azimuth to jump if abs(sin(altitude)) > 1 - 0.01, i.e.
abs(altitude) > arcsin(1 - 0.01) ≈ 81.890386°
If it is possible to lower the difference below 0.01, it would reduce this problem,
but I'm not sure it won't cause instability elsewhere, unless precision is consistently double:
0.01 => 81.890386°
0.001 => 87.437441°
0.0001 => 89.189709°
0.00001 => 89.743765°
0.000001 => 89.918972°
0.0000001 => 89.974377°
0.00000001 => 89.991897°
I read the Zenith scripting issue #754, so I know this is a can of worms you may not want to dig into again, but this bug is a new, non-script-related, manifestation of the same basic problem with sub-optimally written geometric projection handling.
Also, the extra space between "0.01" and ")" could be removed for consistency if you do something about the code.