From 7b31e4fdcf0e0d8a34ae9ea6424304f136eac1cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Motiejus=20Jak=C5=A1tys?= Date: Wed, 19 May 2021 22:57:50 +0300 Subject: [PATCH] exaggeration step and visuals --- mj-msc.tex | 34 +++++++++++++++++++++++++++++++--- test.sql | 20 -------------------- vars.awk | 8 ++++++-- visuals.sql | 20 ++++++++++++++++++++ 4 files changed, 57 insertions(+), 25 deletions(-) diff --git a/mj-msc.tex b/mj-msc.tex index 2e0dc2e..f98f7e1 100644 --- a/mj-msc.tex +++ b/mj-msc.tex @@ -1070,7 +1070,7 @@ The smaller the distance $d$, the more similar the bends are. Figure~\ref{fig:elimination-through-iterations} illustrates steps of figure 8 from the original paper. There is not much to add to the original description -beyond an illustrated example. +beyond repeating the elimination steps in an illustrated example. \begin{figure}[ht] \centering @@ -1092,11 +1092,39 @@ beyond an illustrated example. \subsection{Combination Operator} -NOTE: not implemented. +Combination operator was not implemented in this version. \subsection{Exaggeration Operator} -NOTE: implemented, explain. Also {\textsc intersection\_tolerance} parameter. +Exaggeration operator finds bends whose \textsc{adjusted size} is smaller than +the incoming parameter --- \textsc{half-circle diameter}. Once it finds the +bend, it will exaggerate it in increments until either becomes true: + +\begin{itemize} + \item \textsc{adjusted size} of the exaggerated bend is larger than area of + the half-circle. + \item The exaggerated bend starts intersecting with a neighboring bend. Then, +\end{itemize} + +Exaggeration operator requires a constant \textsc{exaggeration step} $s$, which +should be between 1 and 2. It was arbitrarily picked to \exaggerationEnthusiasm +for this implementation. A single exaggeration increment is done as follows: + +\begin{enumerate} + \item Find a candidate bend. + \item Find the bend's baseline. + \item Find \textsc{midpoint}, the center of the bend's baseline. + + \item Mark each bend's vertex with a number between $[1,s]$. The number is + derived with elements linearly interpolated between the start and + mid-points of the bend. The other half of the bend, from mid-point to + the final vertex, is linearly interpolated between $[s,1]$. + + \item Each point will be placed farther away from the baseline. The length + of misplacement is the marked value in the previous step. I.e. + +\end{enumerate} + \section{Program Implementation} diff --git a/test.sql b/test.sql index a1da6d9..5dc61ce 100644 --- a/test.sql +++ b/test.sql @@ -61,26 +61,6 @@ begin ways = array((select way from wm_debug where stage=_stage and name=_name order by id)); end $$ language plpgsql; -do $$ - declare fig6b1 geometry; - declare fig6b2 geometry; - declare sclong geometry; - declare scshort geometry; -begin - delete from wm_visuals where name like 'fig6-%' or name like 'selfcrossing-1%'; - - select way from wm_debug where name='fig6' and stage='bbends' and gen=1 into fig6b1 limit 1 offset 0; - select way from wm_debug where name='fig6' and stage='bbends' and gen=1 into fig6b2 limit 1 offset 2; - insert into wm_visuals (name, way) values('fig6-baseline', st_makeline(st_startpoint(fig6b2), st_endpoint(fig6b2))); - insert into wm_visuals (name, way) values('fig6-newline', st_makeline(st_endpoint(fig6b1), st_endpoint(fig6b2))); - - select way from wm_debug where name='selfcrossing-1' and stage='bbends' and gen=1 into sclong limit 1 offset 1; - select way from wm_debug where name='selfcrossing-1' and stage='bbends' and gen=1 into scshort limit 1 offset 4; - insert into wm_visuals (name, way) values('selfcrossing-1-baseline', st_makeline(st_startpoint(sclong), st_endpoint(sclong))); - insert into wm_visuals (name, way) values('selfcrossing-1-newline', st_makeline(st_startpoint(sclong), st_endpoint(scshort))); -end $$ language plpgsql; - - do $$ declare vbends geometry[]; diff --git a/vars.awk b/vars.awk index 7fa2fea..5e8d7fe 100644 --- a/vars.awk +++ b/vars.awk @@ -9,13 +9,17 @@ BEGIN { FS="[(); ]" } /isolation_threshold constant real default / { x2 += 1; d2 = sprintf("\\newcommand{\\isolationThreshold}{%.2f}",$7); - +} +/scale constant float default / { + x3 += 1; + d3 = sprintf("\\newcommand{\\exaggerationEnthusiasm}{%.1f}",$7); } END{ - if(x1 == 1 && x2 == 1) { + if(x1 == 1 && x2 == 1 && x3 == 1) { print d1 > "vars.inc.tex" print d2 >> "vars.inc.tex" + print d3 >> "vars.inc.tex" } else { exit 1 } diff --git a/visuals.sql b/visuals.sql index 800c366..89e74a0 100644 --- a/visuals.sql +++ b/visuals.sql @@ -80,6 +80,26 @@ insert into wm_visuals(name, way) values('salvis', ( ) )); +do $$ + declare fig6b1 geometry; + declare fig6b2 geometry; + declare sclong geometry; + declare scshort geometry; +begin + delete from wm_visuals where name like 'fig6-%' or name like 'selfcrossing-1%'; + + select way from wm_debug where name='fig6' and stage='bbends' and gen=1 into fig6b1 limit 1 offset 0; + select way from wm_debug where name='fig6' and stage='bbends' and gen=1 into fig6b2 limit 1 offset 2; + insert into wm_visuals (name, way) values('fig6-baseline', st_makeline(st_startpoint(fig6b2), st_endpoint(fig6b2))); + insert into wm_visuals (name, way) values('fig6-newline', st_makeline(st_endpoint(fig6b1), st_endpoint(fig6b2))); + + select way from wm_debug where name='selfcrossing-1' and stage='bbends' and gen=1 into sclong limit 1 offset 1; + select way from wm_debug where name='selfcrossing-1' and stage='bbends' and gen=1 into scshort limit 1 offset 4; + insert into wm_visuals (name, way) values('selfcrossing-1-baseline', st_makeline(st_startpoint(sclong), st_endpoint(sclong))); + insert into wm_visuals (name, way) values('selfcrossing-1-newline', st_makeline(st_startpoint(sclong), st_endpoint(scshort))); +end $$ language plpgsql; + + do $$ declare i integer;