summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Hofmann <Johannes.Hofmann@gmx.de>2026-10-30 09:44:43 +0100
committerJohannes Hofmann <Johannes.Hofmann@gmx.de>2026-10-30 09:44:43 +0100
commitce3b45ddaab7ddc7017fa75dc5de64cd6ca70f93 (patch)
tree483137f2e9f1a508af4ae6a8541cd5a70321a51a
parentfc07e1b7b2849110679abc806760567a47c36e9f (diff)
cli: -V flag; restricted export ignores occlusion; web visibility knob
- 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)
-rw-r--r--crates/gipfel-cli/src/main.rs15
-rw-r--r--crates/gipfel-core/src/panorama.rs7
-rw-r--r--examples/Makefile17
3 files changed, 30 insertions, 9 deletions
diff --git a/crates/gipfel-cli/src/main.rs b/crates/gipfel-cli/src/main.rs
index f0690a8..06b1447 100644
--- a/crates/gipfel-cli/src/main.rs
+++ b/crates/gipfel-cli/src/main.rs
@@ -12,7 +12,7 @@ fn usage() {
\n\
commands:\n\
\x20 export-position <img> print position CSV line\n\
- \x20 export-hills <img> [-d <data>] [-e <hills>] export hill positions\n\
+ \x20 export-hills <img> [-d <data>] [-e <hills>] [-V <r>] export hill positions\n\
\x20 info <img> show parsed metadata\n\
\x20 stitch [-t out.tif [-4]] [-j out.jpg] [-w N]\n\
\x20 [-h N] [-r from,to] [-b] img... cylindrical panorama\n\
@@ -45,7 +45,7 @@ fn fmt_f(v: f64) -> String {
}
}
-fn export_hills(img: &str, data: &str, export_file: Option<&str>) -> i32 {
+fn export_hills(img: &str, data: &str, export_file: Option<&str>, vis: f64) -> i32 {
let Some((w, h)) = image_dimensions(img) else {
eprintln!("could not read image {}", img);
return 1;
@@ -61,7 +61,7 @@ fn export_hills(img: &str, data: &str, export_file: Option<&str>) -> i32 {
eprintln!("Could not load datafile {}: {}", data, e);
return 1;
}
- pan.set_height_dist_ratio(0.07); // C default "visibility"
+ pan.set_height_dist_ratio(vis); // "visibility" threshold, C default 0.07
if !have_info {
eprintln!("No gipfel info available for {}.", img);
@@ -328,9 +328,16 @@ fn main() {
let img = &args[2];
let mut data = "gipfel.dat".to_string();
let mut export_file: Option<String> = None;
+ let mut vis = 0.07;
let mut i = 3;
while i < args.len() {
match args[i].as_str() {
+ "-V" => {
+ if i + 1 < args.len() {
+ vis = args[i + 1].trim().parse().unwrap_or(0.07);
+ i += 1;
+ }
+ }
"-d" => {
if i + 1 < args.len() {
data = args[i + 1].clone();
@@ -347,7 +354,7 @@ fn main() {
}
i += 1;
}
- export_hills(img, &data, export_file.as_deref())
+ export_hills(img, &data, export_file.as_deref(), vis)
}
}
"info" => {
diff --git a/crates/gipfel-core/src/panorama.rs b/crates/gipfel-core/src/panorama.rs
index 9e27251..3737606 100644
--- a/crates/gipfel-core/src/panorama.rs
+++ b/crates/gipfel-core/src/panorama.rs
@@ -448,8 +448,13 @@ impl Panorama {
let mut rows = Vec::new();
for &i in &self.visible {
let m = &self.hills[i];
+ // restricted mode (-e, a curated list such as the photo
+ // index): export every listed entry inside the field of
+ // view. The prominence/occlusion heuristics are meant to
+ // thin out the full 21k peak database, not to second-guess
+ // an explicit list.
if m.flags & crate::hill::FLAG_DUPLIC != 0
- || m.flags & crate::hill::FLAG_HIDDEN != 0
+ || (!require_export && m.flags & crate::hill::FLAG_HIDDEN != 0)
|| (require_export && m.flags & crate::hill::FLAG_EXPORT == 0)
{
continue;
diff --git a/examples/Makefile b/examples/Makefile
index e3befc6..624b464 100644
--- a/examples/Makefile
+++ b/examples/Makefile
@@ -13,11 +13,14 @@
# GIPFEL_CLI path to the gipfel-cli binary
# DATA hill database used for the peak view
# GIPFEL2HTML html generator script
+# V visibility threshold for the peak view (lower shows
+# more, distant peaks; C default was 0.07)
here := $(dir $(lastword $(MAKEFILE_LIST)))
GIPFEL_CLI ?= $(abspath $(here)../target/release/gipfel-cli)
DATA ?= $(abspath $(here)../gipfel.dat)
GIPFEL2HTML ?= $(here)gipfel2html
+V ?= 0.05
images := $(wildcard *.jpg)
slides := $(addprefix gipfelweb/slides/, $(images))
@@ -61,17 +64,23 @@ gipfelweb/thumbs/%.jpg: %.jpg
gipfelweb/gipfel/%.pos: %.jpg
$(GIPFEL_CLI) export-position $< > $@
+# photo cross-links: the position index holds only a handful of
+# entries, so disable the prominence filter entirely (-V 0); it is
+# meant for the 21k peak database, not for neighbouring photos
+#
+# per-image %.opts are appended after the standard flags, so they can
+# override -d/-V
gipfelweb/gipfel/%.imgs: gipfelweb/slides/%.jpg %.opts gipfelweb/gipfel/index.gipfel
- $(GIPFEL_CLI) `cat $*.opts` export-hills $< -d $(DATA) -e gipfelweb/gipfel/index.gipfel > $@
+ $(GIPFEL_CLI) export-hills $< -d $(DATA) -V 0 -e gipfelweb/gipfel/index.gipfel `cat $*.opts` > $@
gipfelweb/gipfel/%.imgs: gipfelweb/slides/%.jpg gipfelweb/gipfel/index.gipfel
- $(GIPFEL_CLI) export-hills $< -d $(DATA) -e gipfelweb/gipfel/index.gipfel > $@
+ $(GIPFEL_CLI) export-hills $< -d $(DATA) -V 0 -e gipfelweb/gipfel/index.gipfel > $@
gipfelweb/gipfel/%.hills: gipfelweb/slides/%.jpg %.opts
- $(GIPFEL_CLI) `cat $*.opts` export-hills $< -d $(DATA) > $@
+ $(GIPFEL_CLI) export-hills $< -d $(DATA) -V $(V) `cat $*.opts` > $@
gipfelweb/gipfel/%.hills: gipfelweb/slides/%.jpg
- $(GIPFEL_CLI) export-hills $< -d $(DATA) > $@
+ $(GIPFEL_CLI) export-hills $< -d $(DATA) -V $(V) > $@
gipfelweb/gipfel/index.gipfel: $(positions)
cat $(positions) > gipfelweb/gipfel/index.gipfel