diff --git a/II/Referatas/Makefile b/II/Referatas/Makefile index 08adec4..8f5a8a0 100644 --- a/II/Referatas/Makefile +++ b/II/Referatas/Makefile @@ -2,6 +2,7 @@ CROSSING = 622916 6109267 626066 6111487 # xmin ymin xmax ymax ZEIMENA_TOLERANCES = 128 256 512 1024 2048 4096 SINEWAVE_TOLERANCES = 2 16 32 CROSSING_TOLERANCES = 64 128 256 +CHAIKIN_CROSSING_TOLERANCES = 128 256 SINEWAVE_SIZE = 120x48 GEN1 = $(addsuffix .pdf, \ $(addprefix sinewave2_douglas_,$(SINEWAVE_TOLERANCES)) \ @@ -13,12 +14,15 @@ GEN2 = $(addsuffix .pdf, \ $(addprefix overlaid_zeimena_visvalingam_,$(CROSSING_TOLERANCES)) \ $(addprefix overlaid_sinewave2_douglas_,$(SINEWAVE_TOLERANCES)) \ $(addprefix overlaid_sinewave2_visvalingam_,$(SINEWAVE_TOLERANCES))) +GEN3 = $(addsuffix .pdf, \ + $(addprefix overlaid_chaikin_zeimena_douglas_,$(CHAIKIN_CROSSING_TOLERANCES)) \ + $(addprefix overlaid_chaikin_zeimena_visvalingam_,$(CHAIKIN_CROSSING_TOLERANCES))) .PHONY: all all: mj-referatas.pdf mj-prezentacija.pdf mj-referatas.pdf: mj-referatas.tex version.tex bib.bib zeimena.pdf \ - sinewave1.pdf sinewave2.pdf crossing.pdf $(GEN1) $(GEN2) + sinewave1.pdf sinewave2.pdf crossing.pdf $(GEN1) $(GEN2) $(GEN3) latexmk -shell-escape -g -pdf $< mj-prezentacija.pdf: mj-prezentacija.tex ../../misc/Logo_vilniaus_universitetas.png \ @@ -48,6 +52,12 @@ define algo2overlay overlaid_$(1)_$(2)_%.pdf: layer2img.py db/.faux_$(1)_$(2)_% ./layer2img.py $(3) --group1-table=$(1) --group2-table=$(1)_$(2)_$$* \ --outfile $$@ +chaikin_overlaid_$(1)_$(2)_$(3)_%.pdf: layer2img.py db/.chaikin_$(1)_$(2)_% + ./layer2img.py $(3) \ + --group1-table=$(1) \ + --group2-table=$(1)_$(2)_$$* \ + --group3-table=chaikin_$(1)_$(2)_$$* \ + --outfile $$@ endef define gpkg2pdf $(1): $(2) ./layer2img.py diff --git a/II/Referatas/bib.bib b/II/Referatas/bib.bib index 83865cd..c61a510 100644 --- a/II/Referatas/bib.bib +++ b/II/Referatas/bib.bib @@ -139,3 +139,14 @@ year={1991}, publisher={Longman Scientific \& Technical London} } + +@article{chaikin1974algorithm, + title={An algorithm for high-speed curve generation}, + author={Chaikin, George Merrill}, + journal={Computer graphics and image processing}, + volume={3}, + number={4}, + pages={346--349}, + year={1974}, + publisher={Elsevier} +} diff --git a/II/Referatas/chaikin.sql b/II/Referatas/chaikin.sql new file mode 100644 index 0000000..386ad5e --- /dev/null +++ b/II/Referatas/chaikin.sql @@ -0,0 +1,13 @@ +DROP TABLE IF EXISTS :tbl; + +CREATE TABLE :tbl ( + fid serial NOT NULL, + geom geometry(MULTILINESTRING, 3346) +); + +INSERT INTO :tbl (geom) ( + SELECT + ST_ChaikinSmoothing (geom, 3) AS geoms + FROM + :src); + diff --git a/II/Referatas/mj-referatas.tex b/II/Referatas/mj-referatas.tex index 012ca8a..9c512e1 100644 --- a/II/Referatas/mj-referatas.tex +++ b/II/Referatas/mj-referatas.tex @@ -148,8 +148,14 @@ are often used for line generalization: \item \cite{visvalingam1993line} via \href{https://postgis.net/docs/ST_SimplifyVW.html}{PostGIS SimplifyVW}. + \end{itemize} +Since both algorithms produce jaggy output lines, it is worthwhile to process +those through a widely available \cite{chaikin1974algorithm} smoothing +algorithm via \href{https://postgis.net/docs/ST_ChaikinSmoothing.html}{PostGIS +ChaikinSmoothing}. + Review of the available algorithms will be followed by desiderata for a possible open-source addition. In the end, we will issue a recommendation, which algorithm can be picked up and implemented by an avid GIS developer. @@ -251,10 +257,10 @@ a large circle, ilustrated in figure~\ref{fig:blunt-bent}. \label{fig:blunt-bent} \end{figure} -Once zoomed in to the river crossing area with {\DP} and {\VW} applied, it becomes apparent that both large -blunts are normalized to single lines, the shape becomes jagged and unpleasant -for the eye. See table~\ref{tab:comparison-crossing} on -page~\pageref{tab:comparison-crossing}. +Once zoomed in to the river crossing area with {\DP} and {\VW} applied, it +becomes apparent that both large blunts are normalized to single lines, the +shape becomes jagged and unpleasant for the eye. See +table~\ref{tab:comparison-crossing} on page~\pageref{tab:comparison-crossing}. \begin{figure}[h] \renewcommand{\tabularxcolumn}[1]{>{\center\small}m{#1}} @@ -280,6 +286,31 @@ page~\pageref{tab:comparison-crossing}. \label{tab:comparison-crossing} \end{figure} +As the reader may observe, the output lines, especially with higher tolerances, +are jaggy. Higher-tolerance jaggy outputs from {\VW} and {\DP}, passed through Chaikin, +are displayed in table~\ref{tab:chaikin-crossing} on +page~\page{tab:chaikin-crossing}. + +\begin{figure}[h] + \renewcommand{\tabularxcolumn}[1]{>{\center\small}m{#1}} + \begin{tabularx}{\textwidth}{ p{2.1cm} | X | X | } + Tolerance DP/VW & + Douglas \& Peucker & + Visvalingam-Whyatt \tabularnewline \hline + + 128/16384 & + \includegraphics[width=\linewidth]{chaikin_overlaid_zeimena_douglas_128} & + \includegraphics[width=\linewidth]{chaikin_overlaid_zeimena_visvalingam_128} \tabularnewline \hline + + 256/65536 & + \includegraphics[width=\linewidth]{chaikin_overlaid_zeimena_douglas_256} & + \includegraphics[width=\linewidth]{chaikin_overlaid_zeimena_visvalingam_256} \tabularnewline \hline + + \end{tabularx} + \caption{Chaikin-smoothened {\DP} and {\VW} on river crossing area} + \label{tab:chaikin-crossing} +\end{figure} + There is another issue on the wishlist beyond jaggyness and loss of large bents -- combining close bends to larger ones.