From 199f8b292716ab2c56919acb7e573bb3bc64d98b Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Tue, 23 Jul 2024 23:13:25 +0200 Subject: [PATCH] rogueviz::sag:: minor changes, docs updated --- rogueviz/sag/README.md | 25 ++++++++++++++++++++++--- rogueviz/sag/cells.cpp | 1 + rogueviz/sag/sag.cpp | 3 +++ 3 files changed, 26 insertions(+), 3 deletions(-) diff --git a/rogueviz/sag/README.md b/rogueviz/sag/README.md index 69573e57..4af4bfaf 100644 --- a/rogueviz/sag/README.md +++ b/rogueviz/sag/README.md @@ -41,10 +41,29 @@ The rest of this README details how to use SAG. Cells ----- -Not yet documented +If nothing is declared, it just uses all the visible cells (or all cells on closed manifolds), +and the distances are measured in tiles. + +You can change this as follows: + +* `-sag-creq x` -- use x tiles which are geometrically closest to the center (or a bit more in case of ties) + +* `-sag_gdist x` -- take geometric distances instead, 1 absolute units = x units + (this will be rounded to integer because of the limited precision of some methods) + +* `-sag_gdist_dijkstra m` -- compute actual geometric distances if <= m steps, use Dijkstra to compute larger distances + (used in geometries like Solv where the distance computation does not always work for large distances) + +* `-sag_gdist_save filename` -- save the distances to a file + (loading which might be faster than recomputing) + +* `-sag_gdist_load filename` -- load the distances from a file Graph ----- -Just use `-sag-weighted` to read a weighted graph (in format `node1;node2;weight`), -or `-sag-unweighted` to read an unweighted graph (in format `node1 node2`). +Just use `-sag-weighted` to read a weighted graph (in format `node1;node2;weight`), or `-sag-unweighted` to read an unweighted graph (in format `node1 node2`). + +You can also use `-sag-edgepower a b` to use pow(w, a) * b instead of weight w listed in the file (enter this before -sag-weighted). + + See the cpp files for other options available. diff --git a/rogueviz/sag/cells.cpp b/rogueviz/sag/cells.cpp index 9cdc82c1..c9b9b7cc 100644 --- a/rogueviz/sag/cells.cpp +++ b/rogueviz/sag/cells.cpp @@ -603,6 +603,7 @@ int cell_read_args() { dijkstra_tile = true; dijkstra_maxedge = 1; } else if(argis("-sag_gdist_save")) { + init_cells(); shift(); sagdist.save(args()); } diff --git a/rogueviz/sag/sag.cpp b/rogueviz/sag/sag.cpp index 1a2d2960..ee82e34a 100644 --- a/rogueviz/sag/sag.cpp +++ b/rogueviz/sag/sag.cpp @@ -159,6 +159,8 @@ void menu() { optimize_sag_loglik_auto(); }); + dialog::addBoolItem_action(XLAT("visualize (sub)cells"), visualize_subcells_on, 'v'); + dialog::display(); } @@ -322,6 +324,7 @@ void init() { rv_hook(rogueviz::hooks_close, 100, clear); rv_hook(shmup::hooks_turn, 100, turn); + rv_hook(hooks_drawcell, 100, visualize_subcells); rv_hook(rogueviz::hooks_rvmenu, 100, [] { dialog::addItem("SAG settings", 's'); dialog::add_action_push(menu);