generate smallAngle

This commit is contained in:
Motiejus Jakštys 2021-05-19 22:57:47 +03:00 committed by Motiejus Jakštys
parent d66013892b
commit 7e9090c29d
3 changed files with 33 additions and 6 deletions

View File

@ -22,7 +22,7 @@ test-integration: .faux_filter-rivers
clean: clean:
-./db stop -./db stop
-rm -r .faux_test .faux_filter-rivers .faux_import-osm .faux_db \ -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 \ test-figures.pdf _minted-mj-msc \
$(shell git ls-files -o mj-msc*) \ $(shell git ls-files -o mj-msc*) \
$(SLIDES) \ $(SLIDES) \
@ -38,7 +38,7 @@ clean-tables:
.PHONY: slides .PHONY: slides
slides: $(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 $< latexmk -shell-escape -g -pdf $<
mj-msc-gray.pdf: mj-msc.pdf mj-msc-gray.pdf: mj-msc.pdf
@ -52,7 +52,7 @@ mj-msc-gray.pdf: mj-msc.pdf
-dBATCH \ -dBATCH \
$< $<
mj-msc-full.pdf: mj-msc.pdf version.tex $(ARCHIVABLES) mj-msc-full.pdf: mj-msc.pdf version.inc.tex $(ARCHIVABLES)
cp $< .tmp-$@ cp $< .tmp-$@
for f in $^; do \ for f in $^; do \
if [ "$$f" = "$<" ]; then continue; fi; \ if [ "$$f" = "$<" ]; then continue; fi; \
@ -137,9 +137,12 @@ $(SOURCE):
wget http://download.geofabrik.de/europe/$@ wget http://download.geofabrik.de/europe/$@
REF = $(shell git describe --abbrev=12 --always --dirty) 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))}%' > $@ 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 slides-2021-03-29.pdf: slides-2021-03-29.txt
pandoc -t beamer -i $< -o $@ pandoc -t beamer -i $< -o $@

View File

@ -23,7 +23,8 @@
\usepackage{minted} \usepackage{minted}
\usetikzlibrary{er,positioning} \usetikzlibrary{er,positioning}
\definecolor{mypurple}{RGB}{117,112,179} \definecolor{mypurple}{RGB}{117,112,179}
\input{version} \input{version.inc}
\input{vars.inc}
\newcommand{\onpage}[1]{\ref{#1} on page~\pageref{#1}} \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. \item Return result.
\end{enumerate} \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. 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 In this case, steps \ref{rev1} and \ref{rev2} could be remove. That would save
both memory and computation time. 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{Self-line Crossing When Cutting a Bend}
\section{Attributes of a Single Bend} \section{Attributes of a Single Bend}

20
vars.awk Executable file
View File

@ -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
}
}