| Age | Commit message (Collapse) | Author |
|
A fixed height_dist_ratio is wrong everywhere: the default shows
hundreds of peaks from a high alpine viewpoint and nothing from flat
country. On image load the app now picks the ratio by binary search
(visible count is monotone decreasing in the ratio): the LARGEST ratio
in the slider range that still leaves at least 8 peaks in the view -
the sparsest view that is not empty. Dense terrain that cannot get
under 40 even at the sparsest setting is accepted (user can tighten
the slider); so is flat terrain that stays under 8 at the most
generous setting. A URL-pinned ?vis= wins and disables the search.
The lens-FOV limit is now computed in the load handler before the
count (the render-time sync would only apply it a frame later).
Panorama::auto_visibility(lo, hi) lives in core with four tests:
target band hit, flat-terrain floor, dense-terrain overshoot, and
no-op when the current ratio is already reasonable.
|
|
(cylindrical)'
The dropdown mixed styles ('Rectilinear projection' vs 'Cylindrical
(panoramic)'). Both options now lead with the user-facing word and put
the geometric name in parentheses. The same-side fit error refers to
'Panorama (cylindrical) mode' to match the menu entry.
|
|
The rms > 30 px gate was a heuristic backstop, and a flawed one: pixels
are the wrong unit (30 px means something different on a 600 px crop
than on a 4000 px panorama), and over-determined fits - 4+ markers,
unmodeled distortion, honest marker slop - routinely sit at tens of px
RMS while being perfectly good fits. Rejecting those would be worse
than the garbage-commits it was guarding against, which the principled
checks (marker order, same-side feasibility, validity filter) already
cover exactly.
RMS is still computed and printed to the fit session log as a purely
informational line (final rms=NN.Npx).
|
|
With the real issue identified (panorama geometry fitted rectinearly:
provably unsatisfiable marker sets) the pieces added while chasing it
were re-evaluated against a 543-placement sweep of VALID geometries
(straddle + same-side pairs, north crossings, pitch/roll spread,
marker noise, cylindrical wide pairs):
- center seeds: the six-way full-circle spread is unnecessary; the
placement roulette it was built against was the degenerate cost ties
(fixed by the validity filter) and the panorama phantom. A single
derived center seed passes all 543 valid placements. The principled
scale (linear + tangent-aware) and pitch seeds stay: 4 fits total.
- final domain guard: redundant. The validity filter already enforces
the same condition before a candidate can be chosen; the fallback
path is caught by the RMS guard with a better message.
- the sweep itself is promoted to tests/fit_sweep.rs as the permanent
regression net for the seed/validity logic.
Kept (each fixes a real, independent bug): repaint + refit on
projection switch, validity-filtered candidate selection, marker order
check, same-side feasibility pre-check with panorama hint, RMS guard,
fit session logging (the instrument that found the issue).
43 core + 13 golden + 543-placement sweep green, clippy clean.
|
|
'only 22.7x apart in the image' was ambiguous next to pixel x
coordinates. State the ratio as a distance-from-center comparison with
the actual pixel distances:
ZUGSPITZE is 22.7 times farther from the image center than SAEULING
(3398 px vs 150 px, both right of center). A pair 80.4 deg apart in
azimuth needs a distance ratio of at least 140 in rectilinear mode.
This looks like a panorama - switch to cylindrical mode, or place
the view center between the peaks.
|
|
For a rectilinear image, two markers with azimuth separation D that sit
on the SAME side of the image center must obey
|x_far / x_near| >= tan^2(45deg + D/2)
(the minimum of tan(u+D)/tan(u) over all valid view centers). Below
that no center/scale exists - the typical cause being a panorama
(linear pixel spacing) fitted in rectilinear mode.
comp_params now tests every marker pair against this bound BEFORE the
optimizer runs and answers e.g.
SAEULING and ZUGSPITZE are 80.4 deg apart in azimuth but only 22.7x
apart in the image (both right of center); rectilinear geometry
needs at least 140x for a pair this wide. This looks like a panorama
- switch to cylindrical mode, or place the view center between the
peaks.
The bound diverges as D -> 90 deg, so same-side pairs 90+ deg apart are
correctly always rejected. A 10% tolerance absorbs the elevation/pitch/
distortion perturbations of the pure-tangent model; the RMS guard from
the previous commit remains as the backstop for other unsatisfiable
marker sets (e.g. y-inconsistent placements).
Tests: the user's captured panorama markers now produce the panorama
hint in rectilinear mode and fit exactly in cylindrical mode; a
same-side pair is verified to fit just above the ratio bound and be
named-and-rejected just below it.
|
|
User session log (browser console) showed the failure mode precisely:
a panorama (Saeuling az 11.2 at px 150, Zugspitze az 91.7 at px 3398,
linear pixel spacing) switched to rectilinear mode. Every seed landed
at cost ~12900 (RMS ~80 px) and the fitter committed the garbage
(pitch -81 deg, scale 91) because it merely passed the sanity filters.
Rectilinear geometry cannot represent linear pixel spacing over wide
spans: for an azimuth pair d apart, the x-ratio has a hard minimum
(~5 for d = 40.9 deg, and it grows with d), so such marker sets have
provably NO exact solution - the old 'always solvable' assumption held
only for tan-consistent spacings.
comp_params now computes rms = sqrt(cost/n) from the final cost and
rejects rms > 30 px with:
Fit cannot match the markers (RMS 80 px) - this projection cannot
represent the marked geometry. Is this a panorama? Switch to
cylindrical mode.
Regression test uses the user's exact captured marker data. Also fixed
a synthetic test placement (800/300 px for a 40.9 deg pair) that was
itself rectilinearly impossible - the guard caught it, which is a nice
independent confirmation.
|
|
comp_params now records every decision in a drainable per-thread log:
input markers (name, azimuth, elevation, pixel positions), incoming
parameters (incl. distortion), the derived d_img/scale/center seeds,
EVERY seed attempt (center, scale, pitch, cost, valid/INVALID), the
chosen solution or the plain fallback, and every rejection reason.
The web front end drains it after each refit and prints it to the
browser console (DevTools -> Console) under 'gipfel fit session'.
Failing placements can now be reported by simply copying the console
block - it contains everything needed to reproduce the fit verdict
offline.
Example:
comp_params proj_view=60deg n=2 start[center=0.00 ...] markers: [0] Zugspitze az=58.40 ... px=(500,-200) ...
d_img=-40.90deg scale0=1401 center0=37.95deg scale_seeds=[1401 1341]
seed c= 38.0 s= 1401 p= 0.00 cost= 0.000 valid
chosen cost=0.000 center=37.396 pitch=-3.294 roll=5.681 scale=1341.1
|
|
A rectilinear image lists peaks in azimuth order (real roll stays far
below 45 deg), so marking the second peak on the wrong side of the
first cannot be fitted - but until now the fitter either returned a
barely-valid garbage solution (center parked at a marker azimuth
+/-90 deg, scale at the sanity floor) or a confusing domain error.
comp_params now checks the marker order up front (rectilinear only -
cylindrical panoramas legitimately wrap) and answers e.g.
Wrong marker order: Saeuling (az 17.5 deg) must be left of
Zugspitze (az 58.4 deg) in the image
Tests: swapped Zugspitze/Saeuling order rejected with that message;
correct order fits at any sane spacing, either side of center.
|
|
The real cause of the placement-dependent 'fit failed': the exactly-
determined two-marker system has SEVERAL EXACT solutions - cost ties.
Degenerate ones (scale ~30 px, center at a marker azimuth +/- 90 deg,
where the tangent saturates) match both markers perfectly, won the
lowest-cost race arbitrarily, and were then rejected by the post-hoc
guards. A good solution existed but lost the tie -> random failures
that flipped when a marker moved a few pixels.
Fix: validity (scale >= 50, every known marker inside the projection
domain) now filters candidates INSIDE the seed loop, before the cost
comparison. First near-exact valid result (cost < 1 px^2) ends the
search early, which also makes the typical fit ~75x faster. If no
seed yields a valid fit, a plain run follows so the guards still
produce the most informative error.
Measured on a simulated Thaneller flow (Zugspitze fixed, Saeuling
dragged over a 41x21 grid around its true spot): failures dropped
from 163/861 to 0/861. On a deliberately absurd 61x17 grid (markers
up to 3000 px off): domain rejections 103 -> 0, remaining failures
are honest 'cannot determine scale' cases (marker in the other
peak's x-column).
|
|
Experiment requested while chasing the remaining placement-dependent
'fit failed' reports: the derived center seed (midpoint of the two
marker azimuths in the image-space branch) can itself be far off when
marker placements are rough, and the optimizer then never sees the
basin containing the true solution. The multi-start now tries six
center seeds 60 deg apart around the full circle, crossed with the
scale and pitch seeds (24 tiny LM runs - test suite time unchanged).
Whatever the marker placement, a seed now starts within 30 deg of any
conceivable true center.
|
|
The view-angle guard introduced earlier used get_view_angle() (60 deg
for rectilinear) - but that is the C original's VISIBILITY heuristic
('peaks this far off center are usually outside the photo'), not the
projection's domain. A wide-angle photo with half-FOV > 60 deg
(ultrawide phones, stitched shots) legitimately shows peaks 60-85 deg
off center; the TRUE fit got rejected, and whether the fitted center
kept both markers under 60 deg depended on exactly where the markers
were placed - the remaining placement-dependent 'fit failed' reports.
The guard now uses the actual domain: +/-90 deg for rectilinear (the
tangent flips sign beyond it), 180 deg for cylindrical. It still
catches camera-looking-backwards solutions and grossly misplaced
markers, now with the limit in the error message.
Tests: rejection moved to 200 deg-apart markers (truly impossible);
new test asserts a +/-70 deg wide-angle photo fits cleanly in
rectilinear mode.
|
|
The exactly-determined two-marker system (4 residuals, 4 parameters)
has multiple solution basins: the tangent repeats every 180 deg in the
view center (a camera looking the opposite way projects identically),
and pitch/roll can absorb marker y errors. With a single start, the
basin the optimizer landed in depended on where the user last dragged
a marker - so the new view-angle guard fired 'randomly', and moving a
marker vertically could flip success and failure.
comp_params now runs the level-1 fit from a small seed set and keeps
the lowest-cost result:
* scale seeds: the linear estimate plus a tangent-aware variant
(rectilinear geometry puts dx = s * 2 * tan(d/2), which the linear
estimate underestimates by up to 60% at wide spans)
* pitch seeds: zero plus a y-derived estimate (tan p ~ tan elev + y/s
per marker, averaged) instead of always starting at pitch 0
lm/lsq now return the final cost for the comparison. Golden fits
unaffected; all 38 core + 13 golden tests pass.
|
|
Investigating the Thaneller report (mark Zugspitze + Saeuling in
rectilinear mode, 'jump totally weird' when Saeuling sits east of
north): a numeric sweep of the Saeuling marker across north with the
real geography shows comp_params is perfectly CONTINUOUS there - it
recovers truth exactly at the true position. What is NOT benign: a fit
whose solution places a marked peak beyond the projection's own view
angle (rectilinear: +/-60 deg). The tangent-compressed solution that
matches far-apart markers is exact for the two markers but scatters
every other peak, and is_visible() hides the marked ones - exactly
'totally weird'.
comp_params now validates every known marker against
proj.get_view_angle() after fitting and returns a descriptive error
(suggesting cylindrical mode) instead of committing the parameters.
Cylindrical's limit is 2pi, so panorama fits are untouched. The web
status line shows 'fit failed: <reason>' in that case.
Tests: rectilinear fit of markers 150 deg apart is rejected; the same
markers fit fine in cylindrical mode; golden fits unaffected.
|
|
View parameters are projection-specific: a cylindrical scale is
linear in azimuth, a rectilinear one tangent-based. Switching
projections kept the old parameters, so the display reinterpreted
them; the first marker drag then refit in the NEW projection,
converging to parameters that are valid there but garbage for the
other one - and switching back showed that garbage until yet another
refit happened to save it (exactly the reported panorama -> rect ->
drag -> back -> crazy -> tiny-drag-fixes-it chain).
* web: the projection dropdown now refits to the markers right after
switching (no-op without markers), so parameters always match the
active projection.
* core: the wide-branch initial guess (markers >180 deg apart in the
image, chosen by the sign of the pixel difference) is now gated to
projections that can show more than a half-plane. Rectilinear
(120 deg max view) always uses the shortest arc.
* regression test: panorama fit -> rectilinear interlude -> refit
recovers the panorama parameters exactly.
|
|
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.
|
|
Confirmed: the cylindrical projection formulas contain no k0/k1/x0 and
its distortion derivative trait defaults are NaN, so a level-2
(distortion) fit cannot move anything there. Worse, comp_params zeroed
the distortion parameters before the (doomed) calibration - so enabling
'Fit distortion' in panorama mode silently destroyed distortion a
rectilinear fit had established.
* core: comp_params probes whether the projection actually provides
distortion derivatives (NaN trait default = no) and skips both the
calibration reset and the level-2 lsq if not. Regression test asserts
k0/k1/x0 survive a fit_distortion=true fit in cylindrical mode.
* web: the fit-distortion checkbox AND the whole distortion-profiles
group now sit in a <fieldset disabled> in cylindrical mode (opacity
0.45), so the dead controls are visibly inert.
* dist: rebuilt.
|
|
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.
|
|
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.
|
|
# Conflicts:
# crates/gipfel-core/src/metadata.rs
|
|
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).
|
|
- ?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
|
|
- 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
|
|
- 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)
|
|
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").
|
|
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%).
|
|
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").
|
|
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)
|
|
- 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)
|
|
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
|
|
Version now lives only in [workspace.package] in the root Cargo.toml;
all three crates inherit it via version.workspace = true (this also fixes
gipfel-core, which had drifted to 0.1.0 while the others were 0.5.4).
edition/license are inherited the same way.
The About dialog now reads env!("CARGO_PKG_VERSION") instead of a
hardcoded string. A new test (changelog_top_matches_version) asserts the
top gipfel-X.Y.Z entry in ChangeLog equals the crate version, so the
manifest, the About dialog and the ChangeLog cannot drift apart.
AGENTS.md gains a "Releasing a new version" section documenting the flow
(bump workspace version, add ChangeLog entry, tag, git archive source
tarball).
|
|
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.
|