diff options
| author | Johannes Hofmann <Johannes.Hofmann@gmx.de> | 2026-10-27 13:55:35 +0100 |
|---|---|---|
| committer | Johannes Hofmann <Johannes.Hofmann@gmx.de> | 2026-10-27 13:55:35 +0100 |
| commit | f6883fa1d586a040bf228ab886b95ca64457fa34 (patch) | |
| tree | 9e071b64c4f1a6ac46a7b4033e0c9a4b284742bb /crates/gipfel-web/src/markers.rs | |
| parent | 0b85e7989eacb26d3496cdb98ed3221868a4013f (diff) | |
Rename web front end to wipfel
'gipfel web' is taken by an existing related project. The browser app
is now wipfel — web based gipfel photogrammetry for mountain images:
crate gipfel-web -> wipfel, updated titles, docs, plan and dev script.
The shared engine crate stays gipfel-core.
Diffstat (limited to 'crates/gipfel-web/src/markers.rs')
| -rw-r--r-- | crates/gipfel-web/src/markers.rs | 60 |
1 files changed, 0 insertions, 60 deletions
diff --git a/crates/gipfel-web/src/markers.rs b/crates/gipfel-web/src/markers.rs deleted file mode 100644 index d024f2e..0000000 --- a/crates/gipfel-web/src/markers.rs +++ /dev/null @@ -1,60 +0,0 @@ -//! Markers: user observations of hills at image positions, plus the -//! refit entry point. Coordinates are center-relative image pixels, -//! matching the projection output space (same convention as the -//! desktop viewport widget). - -use gipfel_core::hill::Hill; -use gipfel_core::panorama::Panorama; - -#[derive(Clone, Debug, PartialEq)] -pub struct Marker { - /// index into `Panorama::hills` (stable: load order is preserved) - pub hill: usize, - pub x: f64, - pub y: f64, -} - -/// Refit the projection parameters to the current markers. -/// Same graduated behavior as the original: 1 marker fits the center -/// angle, 2 add the scale, 4+ the full viewpoint (+ distortion when -/// unlocked and enough markers). -pub fn refit(pan: &mut Panorama, markers: &[Marker], fit_distortion: bool) -> Result<(), String> { - if markers.is_empty() { - return Ok(()); - } - let mut obs: Vec<Hill> = Vec::with_capacity(markers.len()); - for m in markers { - let mut h = pan.hills[m.hill].clone(); - h.x = m.x; - h.y = m.y; - obs.push(h); - } - let known: Vec<usize> = (0..markers.len()).collect(); - pan.comp_params_with(&obs, &known, fit_distortion) -} - -/// Nearest visible hill to image position `(x, y)`, within `max_dist` -/// image pixels. Used to resolve marker clicks. Hills hidden by the -/// occlusion heuristic are skipped unless `show_hidden`. -pub fn nearest_hill( - pan: &Panorama, - x: f64, - y: f64, - max_dist: f64, - show_hidden: bool, -) -> Option<usize> { - let mut best = None; - let mut best_d = max_dist; - for &i in &pan.visible { - if !show_hidden && pan.hills[i].flags & gipfel_core::hill::FLAG_HIDDEN != 0 { - continue; - } - let h = &pan.hills[i]; - let d = (h.x - x).hypot(h.y - y); - if d < best_d { - best_d = d; - best = Some(i); - } - } - best -} |
