diff options
| author | Johannes Hofmann <Johannes.Hofmann@gmx.de> | 2026-11-12 23:06:42 +0100 |
|---|---|---|
| committer | Johannes Hofmann <Johannes.Hofmann@gmx.de> | 2026-11-12 23:06:42 +0100 |
| commit | ffe2b67f5962a1bdafbdaa9862d7623c16558cfd (patch) | |
| tree | 8a1aac4ce97ad6d9a1a8dbe01f3afd736143c9ad /crates/gipfel-core/src/projection/mod.rs | |
| parent | 9f1f7bb5c4c32072db0bf38b192a8e892405b869 (diff) | |
core: consolidate the three ad-hoc azimuth wraps into wrap_angle
ProjArgs::from_params now normalizes the mountain azimuth centrally,
so the two remaining hand-rolled wraps are redundant:
* get_coordinates dropped its single-step +/-2pi normalization (a
leftover of the C++ original that could not even handle azimuths
more than one full turn off); from_params covers it strictly more
generally.
* is_visible's abs-mod-fold became one wrap_angle call. The explicit
is_finite guard stays (wrap_angle's NaN would silently pass the
>= view_angle test when max_view_angle is 0).
No behavior change: 35 core + 13 golden tests, including the Finding 1
regression test and all north/wide-panorama tests, pass unmodified.
Diffstat (limited to 'crates/gipfel-core/src/projection/mod.rs')
| -rw-r--r-- | crates/gipfel-core/src/projection/mod.rs | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/crates/gipfel-core/src/projection/mod.rs b/crates/gipfel-core/src/projection/mod.rs index 360c377..d0221e8 100644 --- a/crates/gipfel-core/src/projection/mod.rs +++ b/crates/gipfel-core/src/projection/mod.rs @@ -172,18 +172,10 @@ pub trait Projection: Send + Sync { NAN } - /// Project azimuth/elevation to image coordinates (relative to image center), - /// normalizing azimuth around the view center like the C++ original. + /// Project azimuth/elevation to image coordinates (relative to image + /// center). Azimuth normalization around the view center happens once, + /// centrally, in [`ProjArgs::from_params`]. fn get_coordinates(&self, alph: f64, elev: f64, parms: &ViewParams) -> (f64, f64) { - let mut alph = alph; - let pi = crate::hill::PI; - - if alph - parms.a_center > pi { - alph -= 2.0 * pi; - } else if alph - parms.a_center < -pi { - alph += 2.0 * pi; - } - let args = ProjArgs::from_params(parms, alph, elev); (self.mac_x(args), self.mac_y(args)) } |
