From bac0905f390315b2b0f998999b2c820dd04224ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Motiejus=20Jak=C5=A1tys?= Date: Wed, 19 May 2021 22:57:47 +0300 Subject: [PATCH] average curvature and isolated bend --- mj-msc.tex | 16 ++++++++++++++-- vars.awk | 19 +++++++++++-------- 2 files changed, 25 insertions(+), 10 deletions(-) diff --git a/mj-msc.tex b/mj-msc.tex index c5254d7..3564dd3 100644 --- a/mj-msc.tex +++ b/mj-msc.tex @@ -503,10 +503,22 @@ find out similar ones. \subsection{Isolated Bend} -Bend itself and its extensions can be described by \textsc{average curvature}, +Bend itself and its "isolation" can be described by \textsc{average curvature}, which is \textcquote{wang1998line}{geometrically defined as the ratio of inflection over the length of a curve.} +Two conditions must be true to claim that a bend is isolated: + +\begin{enumerate} + \item \textsc{average curvature} of neighboring bends, should be larger + than the "candidate" bend's curvature; this implementation arbitrarily + chose $\isolationThreshold$. + + \item Bends on both sides of the "candidate" should be longer than a + certain value. This implementation does not (yet) define such a + constraint and will only follow the average curvature constraint above. +\end{enumerate} + \subsection{The Context of a Bend: Isolated and Similar Bends} To find out whether two bends are similar, they are compared by 3 components: @@ -527,7 +539,7 @@ $q$: (baseline_p-baseline_q)^2} \] -The smaller the distance $d$, the more similar the bends are. +The more similar the bends are, the smaller the distance $d$. \subsection{Elimination Operator} diff --git a/vars.awk b/vars.awk index e7b1a8e..7fa2fea 100644 --- a/vars.awk +++ b/vars.awk @@ -1,18 +1,21 @@ #!/usr/bin/awk -f -BEGIN { FS="[() ]" } +BEGIN { FS="[(); ]" } /small_angle constant real default radians/ { - if(d) { - exit 1 - } else { - d = sprintf("\\newcommand{\\smallAngle}{\\frac{\\pi}{%d}}\n",180/$8); - } + x1 += 1; + d1 = sprintf("\\newcommand{\\smallAngle}{\\frac{\\pi}{%d}}",180/$8); +} +/isolation_threshold constant real default / { + x2 += 1; + d2 = sprintf("\\newcommand{\\isolationThreshold}{%.2f}",$7); + } END{ - if(d) { - print d > "vars.inc.tex" + if(x1 == 1 && x2 == 1) { + print d1 > "vars.inc.tex" + print d2 >> "vars.inc.tex" } else { exit 1 }