summaryrefslogtreecommitdiff
path: root/crates/gipfel-core/src
AgeCommit message (Collapse)Author
8 dayscore: fix fit for wide panoramas (markers >180 deg apart in image)Johannes Hofmann
The initial guess in comp_params assumed the two markers are less than 180 deg apart: a_center started on the first marker and the scale came from the shortest-arc azimuth difference. In panoramas wider than 180 deg the markers can straddle the seam - e.g. at -170 deg and +170 deg of the view center they are 340 deg apart in the image but only 20 deg on the compass. The start was then off by up to 170 deg in azimuth and a factor of 17 in scale, and the fit never recovered. Fix: derive the image-space azimuth difference from the SIGN OF THE PIXEL DIFFERENCE (the user's marker placement tells us which branch was meant; the magnitude is unique modulo 2pi for panoramas below 360 deg), and start the view center between the markers in that branch. The golden fit tests now compare a_center modulo 2pi: the C harness settles wherever its >2pi input azimuths put it (380 deg), the Rust port normalizes (20 deg) - same physical solution. Tests: fits with markers 340 deg apart, 350 deg apart in reversed marker order, and 200 deg apart (just over the seam). All three fail without the fix (verified), pass with it.
8 dayscore: fix fit when north lies between the two markersJohannes Hofmann
With markers at e.g. 350 deg and 10 deg the raw azimuth difference is 340 deg instead of 20 deg. Two places choked on that: * ProjArgs::from_params fed the raw difference into the projection formulas. The cylindrical projection uses it LINEARLY (x = scale * (m_view - c_view)), so the 350 deg peak was projected 350 degrees of scale to the right of center instead of 10 degrees to the left - no parameter set can satisfy both markers and the panorama-mode fit fails. The rectilinear projection is periodic and unaffected. Fix: represent m_view as c_view + wrapped difference, so every consumer (fit residuals, Jacobian, project_point) sees the shortest arc. get_coordinates already normalized for exactly this reason; the fit path bypassed it. * comp_params derived the initial scale from |d_alph| = 340 deg, an initial scale off by a factor of 17 - this hit rectilinear mode too. Use the wrapped difference. Regression tests: two-marker fits across north for both projections (the cylindrical one fails without the fix), plus a direct check that a 350 deg peak projects to -10 deg * scale.
10 daysMerge branch 'wasm-spike'Johannes Hofmann
# Conflicts: # crates/gipfel-core/src/metadata.rs
10 dayscore: is_visible wraps the azimuth difference and rejects non-finite inputJohannes Hofmann
GipfelFind.lean Finding 1: with |alph - a_center| > 2pi (user enters azimuth 400deg, or a fit leaves a_center unnormalized) the single fold produced a NEGATIVE 'distance' that passed every comparison, making hills behind the camera visible. NaN or infinite azimuths — and a NaN center, which made everything visible — passed as well. Fix at the point of use: wrap with % 2pi before the fold, and bail out on non-finite alph/a_center. Regression test pins the Lean witnesses (out_of_range_center_angle_stays_safe).
11 daysweb: projection switch, external image URLs, zoom buttonsJohannes Hofmann
- ?file= now also accepts absolute http(s) image URLs (CORS applies); README documents all URL parameters - Projection dropdown (rectilinear / cylindrical-panoramic), synced from the gipfel comment on load; cylindrical lifts the lens-FOV visibility limit (unlimited view angle) so 360 deg panoramas show peaks in every direction - force visibility rebuild on every image load (the change detection alone could keep a stale list when the limit value was unchanged) - Google-Maps-style +/- zoom buttons at the lower right of the canvas - save/load roundtrip test for the projection type in the gipfel comment; build stamp in the sidebar footer and ?debug=1 console diagnostics to spot stale cached bundles and inspect the effective visibility state
2026-11-06wasm front end becomes the main gipfel; add desktop installersJohannes Hofmann
- 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
2026-10-30cli: -V flag; restricted export ignores occlusion; web visibility knobJohannes Hofmann
- gipfel-cli export-hills gains -V <ratio> (the visibility/prominence threshold, C default 0.07); default unchanged - export_hill_rows: restricted mode (-e, curated lists like the gipfelweb photo index) no longer drops FLAG_HIDDEN entries. The occlusion heuristic is for thinning the full peak database; a curated photo list should show every entry inside the field of view. Unrestricted export (golden-pinned) unchanged. - gipfelweb Makefile: V ?= 0.05 knob for the peak view, -V 0 for the photo index; per-image %.opts now appended after the standard flags (they were placed before the subcommand and silently ignored)
2026-10-28core: guard atof prefix slicing against char boundariesJohannes Hofmann
The longest-numeric-prefix fallback sliced s[..i] at every byte index, which panics when i lands inside a multi-byte character (reachable via lossy-decoded Latin-1 database fields, e.g. a trailing degree sign). Skip non-boundary indices; behavior on ASCII numeric fields is unchanged. Includes regression test atof("12.5 deg").
2026-10-28core: fix focal-length-to-scale constant (36 mm film width, not 35)Johannes Hofmann
The 35mm film frame is 36 mm wide, so a lens with 35mm-equivalent focal length f projects with focal length f*w/36 in pixels. The original C++ code divided by 35, making the EXIF-derived initial scale ~2.9% too large (and the fitted focal readout ~2.9% low). - EXIF init and the focal slider/readout now use /36 - the gipfel JPEG comment KEEPS its historical scale*35/w encoding (focal_from_comment flag), so annotated JPEGs written by any older gipfel version still reproduce the identical view, and files saved by this version remain readable by them - new regression test focal_scale_exif_vs_comment; golden tests untouched (they pin the comment path) Verified against real photos: optical shots now agree with EXIF within ~1% (was ~3.6%).
2026-10-28core: guard atof prefix slicing against char boundariesJohannes Hofmann
The longest-numeric-prefix fallback sliced s[..i] at every byte index, which panics when i lands inside a multi-byte character (reachable via lossy-decoded Latin-1 database fields, e.g. a trailing degree sign). Skip non-boundary indices; behavior on ASCII numeric fields is unchanged. Includes regression test atof("12.5 deg").
2026-10-28core: fix focal-length-to-scale constant (36 mm film width, not 35)Johannes Hofmann
The 35mm film frame is 36 mm wide, so a lens with 35mm-equivalent focal length f projects with focal length f*w/36 in pixels. The original C++ code divided by 35, making the EXIF-derived initial scale ~2.9% too large (and the fitted focal readout ~2.9% low). - EXIF init and the focal slider/readout in both apps now use /36 - the gipfel JPEG comment KEEPS its historical scale*35/w encoding (focal_from_comment flag), so annotated JPEGs written by any older gipfel version still reproduce the identical view, and files saved by this version remain readable by them - new regression test focal_scale_exif_vs_comment; golden tests untouched (they pin the comment path)
2026-10-27web: GPX track loadingJohannes Hofmann
- core: track::load_gpx_from_bytes (path wrapper delegates to it; same hardening: size cap, no entity expansion, direct-child <ele>) - sidebar: 'Load GPX Track…' button + hidden .gpx file input; the track swaps in via remove_hills(FLAG_TRACK_POINT) + add_hills, so marker hill indices never shift (track hills always live at the end of the hill list) - rendering: desktop parity — consecutive visible points joined with round-cap strokes, width = scale*track_width/(dist_m*10) clamped to [1,1000] image px, red (blue when hidden by terrain); a Track width slider (50-1000 m, default 200) appears in Display once a track is loaded - track points and duplicates are excluded from guide dots, hover and click hit-testing (they are scenery, not markable peaks)
2026-10-27wasm: experimental browser spikeJohannes Hofmann
Proves the gipfel core can run in the browser via WASM. Enabled by the earlier GSL removal: the core is now pure Rust. gipfel-core gains byte-oriented entry points (no filesystem) alongside the existing path-based ones: - hill::load_from_bytes, Panorama::load_data_from_bytes - metadata: load_image_from_bytes, read_jpeg_comment_from_bytes, write_jpeg_comment_to_bytes, save_image_to_bytes (EXIF via Cursor) New crate gipfel-wasm (experimental, not shipped with the app): - wasm-bindgen surface: version() + fit_demo(db_bytes, jpg_bytes) which runs the whole pipeline in memory: parse hill DB, read gipfel JPEG comment / EXIF, synthesize 5 observations from visible hills, perturb, refit (pure-Rust LM), report JSON with reprojection error - demo/index.html: file pickers + result pane (wasm-pack --target web) - build.sh: adds the wasm target, builds with wasm-pack, prints serve cmd - native test runs the same pipeline against gipfel.dat + test.jpg and asserts sub-pixel reprojection error (passes here) To try on a machine with rustup: cd crates/gipfel-wasm && ./build.sh
2026-10-26Replace the C++ implementation with the Rust portJohannes Hofmann
The Rust port (formerly gipfel-rs) is now the official successor to the FLTK/GSL C++ code base. This squashes the port into a single commit and removes the C++ sources (they remain in the git history below). Layout: crates/gipfel-core headless core: hills, panorama geometry, projections (maxima-generated derivatives), pure-Rust LM fit, gipfel: JPEG comment + EXIF I/O, profiles, stitching crates/gipfel-cli command-line tools (export, info, stitch, profiles) crates/gipfel-app Cosmic DE (libcosmic) GUI, binary name `gipfel` codegen/ maxima scripts + regen.sh for the projection code tests/ golden files + C++ reference harnesses (historical) The original README is kept for now; it will be updated to describe the Rust build. gipfel.dat, AUTHORS, ChangeLog and NEWS are unchanged.