From 7e9090c29dc1854969a8ac530e44a3ac83916a88 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] generate smallAngle --- Makefile | 11 +++++++---- mj-msc.tex | 8 ++++++-- vars.awk | 20 ++++++++++++++++++++ 3 files changed, 33 insertions(+), 6 deletions(-) create mode 100755 vars.awk diff --git a/Makefile b/Makefile index 6dd0e9b..eecfe21 100644 --- a/Makefile +++ b/Makefile @@ -22,7 +22,7 @@ test-integration: .faux_filter-rivers clean: -./db stop -rm -r .faux_test .faux_filter-rivers .faux_import-osm .faux_db \ - version.tex version.aux version.fdb_latexmk \ + version.inc.tex vars.inc.tex version.aux version.fdb_latexmk \ test-figures.pdf _minted-mj-msc \ $(shell git ls-files -o mj-msc*) \ $(SLIDES) \ @@ -38,7 +38,7 @@ clean-tables: .PHONY: slides slides: $(SLIDES) -mj-msc.pdf: mj-msc.tex test-figures.pdf version.tex bib.bib $(FIGURES) +mj-msc.pdf: mj-msc.tex test-figures.pdf version.inc.tex vars.inc.tex bib.bib $(FIGURES) latexmk -shell-escape -g -pdf $< mj-msc-gray.pdf: mj-msc.pdf @@ -52,7 +52,7 @@ mj-msc-gray.pdf: mj-msc.pdf -dBATCH \ $< -mj-msc-full.pdf: mj-msc.pdf version.tex $(ARCHIVABLES) +mj-msc-full.pdf: mj-msc.pdf version.inc.tex $(ARCHIVABLES) cp $< .tmp-$@ for f in $^; do \ if [ "$$f" = "$<" ]; then continue; fi; \ @@ -137,9 +137,12 @@ $(SOURCE): wget http://download.geofabrik.de/europe/$@ REF = $(shell git describe --abbrev=12 --always --dirty) -version.tex: Makefile $(shell git rev-parse --git-dir 2>/dev/null) +version.inc.tex: Makefile $(shell git rev-parse --git-dir 2>/dev/null) TZ=UTC date '+\gdef\VCDescribe{%F ($(REF))}%' > $@ +vars.inc.tex: vars.awk wm.sql Makefile + ./$< wm.sql > $@ + slides-2021-03-29.pdf: slides-2021-03-29.txt pandoc -t beamer -i $< -o $@ diff --git a/mj-msc.tex b/mj-msc.tex index 2d54afa..b8f71a5 100644 --- a/mj-msc.tex +++ b/mj-msc.tex @@ -23,7 +23,8 @@ \usepackage{minted} \usetikzlibrary{er,positioning} \definecolor{mypurple}{RGB}{117,112,179} -\input{version} +\input{version.inc} +\input{vars.inc} \newcommand{\onpage}[1]{\ref{#1} on page~\pageref{#1}} @@ -375,11 +376,14 @@ some bends that should be mutated. This implementation does it in the following \item Return result. \end{enumerate} -The current implementation is the most straight-forward, but not optimal: +The current implementation is the most straightforward, but not optimal: reversing of lines and bends could be avoided by walking backwards the lines. In this case, steps \ref{rev1} and \ref{rev2} could be remove. That would save both memory and computation time. +The "quite small angle", as mentioned in the article, was arbitrarily chosen to +$\smallAngle$. + \section{Self-line Crossing When Cutting a Bend} \section{Attributes of a Single Bend} diff --git a/vars.awk b/vars.awk new file mode 100755 index 0000000..3bee31f --- /dev/null +++ b/vars.awk @@ -0,0 +1,20 @@ +#!/usr/bin/awk -f + +BEGIN { + FS="[() ]" +} + +/small_angle constant real default radians/ { + if(d) { + exit 1 + } else { + printf ("\\newcommand{\\smallAngle}{\\frac{\\pi}{%d}}\n",180/$8); + d=1 + } +} + +END{ + if(!d){ + exit 1 + } +}