summaryrefslogtreecommitdiff
path: root/crates/wipfel/src/markers.rs
diff options
context:
space:
mode:
authorJohannes Hofmann <Johannes.Hofmann@gmx.de>2026-11-06 09:52:26 +0100
committerJohannes Hofmann <Johannes.Hofmann@gmx.de>2026-11-06 09:52:26 +0100
commitd5967c1b91b14b3b4e5b0d9663e8a4d2a5e80533 (patch)
tree4ac34f1e81b73b24139ac0eafa2db72f524f2a42 /crates/wipfel/src/markers.rs
parentdbc0fd52a8497c5002e8311eb1728050a4e97c7a (diff)
wasm front end becomes the main gipfel; add desktop installers
- rename crates/wipfel -> crates/gipfel (crate, wasm artifact, dist, scripts, page titles); slogan back to "Photogrammetry for Mountain Images"; crates/wipfel-tauri -> crates/gipfel-desktop - new features in the wasm app: Save image (gipfel JPEG comment, same format as before, via browser download) and lens distortion profiles stored in localStorage in FLTK prefs format with camera auto-match on image load; profile name field, save/load and dropdown - gipfel-core: read GPSImgDirection from EXIF (magnetic -> true) as azimuth fallback; expose parse_prefs/serialize_prefs for the wasm build; ?file=/?az=/?pitch=/?roll=/?focal=/?vis= URL parameters - Tauri v2 wrapper crate building .deb, AppImage and (cross-compiled) Windows NSIS installers; safe stage-and-swap build-release.sh - README: web-centric Installation, concise Build section for the official targets (Web, Windows, Linux); drop native/Android mentions - release site moved dist/wipfel -> dist/gipfel
Diffstat (limited to 'crates/wipfel/src/markers.rs')
-rw-r--r--crates/wipfel/src/markers.rs66
1 files changed, 0 insertions, 66 deletions
diff --git a/crates/wipfel/src/markers.rs b/crates/wipfel/src/markers.rs
deleted file mode 100644
index b8c00aa..0000000
--- a/crates/wipfel/src/markers.rs
+++ /dev/null
@@ -1,66 +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 {
- let flags = pan.hills[i].flags;
- if flags & gipfel_core::hill::FLAG_DUPLIC != 0
- || flags & gipfel_core::hill::FLAG_TRACK_POINT != 0
- {
- continue;
- }
- if !show_hidden && 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
-}