From bebe4cd3bfb162f5a59a15d65ecbdf1a591858e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Motiejus=20Jak=C5=A1tys?= Date: Wed, 27 May 2020 13:53:51 +0300 Subject: [PATCH] two sinewave variants --- II/Referatas/fig2layer.py | 18 +++++++++++++----- II/Referatas/mj-referatas.tex | 16 ++++++++++------ 2 files changed, 23 insertions(+), 11 deletions(-) diff --git a/II/Referatas/fig2layer.py b/II/Referatas/fig2layer.py index c1ee237..816c6e9 100755 --- a/II/Referatas/fig2layer.py +++ b/II/Referatas/fig2layer.py @@ -19,11 +19,18 @@ def write_file(args, geom): def sinewave(args): INTERVAL = 0.1 - TAIL_LEN = 7 - SINE_LEN = 7 - TAILS = np.zeros(int(TAIL_LEN / INTERVAL)) - sin_range = np.arange(-pi/4, SINE_LEN, INTERVAL) - amplitude = (np.sin(sin_range * pi / 2) + 1)*2 + + if args.numwaves == 2: + TAIL_LEN, SINE_LEN = 7, 7 + TAILS = np.zeros(int(TAIL_LEN / INTERVAL)) + sin_range = np.arange(-pi/4, SINE_LEN, INTERVAL) * pi / 2 + amplitude = (np.sin(sin_range)+1)*2 + else: + TAIL_LEN, SINE_LEN = 3.5, 3.5 + TAILS = np.zeros(int(TAIL_LEN / INTERVAL)) + sin_range = np.arange(-pi/4, SINE_LEN - pi/8, INTERVAL) * pi / 2 + amplitude = np.sin(sin_range) + 1 + y = np.concatenate([TAILS, amplitude, TAILS]) x = np.arange(-TAIL_LEN - pi/4, SINE_LEN + TAIL_LEN, INTERVAL) lines = LineString(zip(x*10, y*10)) @@ -47,6 +54,7 @@ def parse_args(): parser.add_argument('-o', '--outfile', metavar='', required=True) subparsers = parser.add_subparsers() sine = subparsers.add_parser('sine', help='Sine wave') + sine.add_argument('--numwaves', choices=[1, 2], type=int, help='Number of waves') sine.set_defaults(func=sinewave) rect = subparsers.add_parser('rect', help='Rectangle') rect.add_argument('--bounds', type=float, nargs=4, metavar=BOUNDS) diff --git a/II/Referatas/mj-referatas.tex b/II/Referatas/mj-referatas.tex index c9316a7..242adb4 100644 --- a/II/Referatas/mj-referatas.tex +++ b/II/Referatas/mj-referatas.tex @@ -239,7 +239,8 @@ Let's zoom in to the river crossing area for some of the algorithms; see table~\ref{tab:comparison-crossing} on page~\pageref{tab:comparison-crossing}. Both {\VW} and {\DP} simplify "blunt" bends (a "blunt" bent looks like a cutout -from a large circle, see figure~\ref{blunt-bent} on page~\pageref{blunt-bent}. +from a large circle, see figure~\ref{fig:blunt-bent} on +page~\pageref{fig:blunt-bent}. \begin{figure}[h] \centering @@ -287,18 +288,18 @@ of the least developed aspects of automatic line generalization, according to \cite{miuller1995generalization}. {\WM} encoded this process to an algorithm. Imagine there are two small bends close to each other, similar to -figure~\ref{pic:sinewave} on page~\pageref{pic:sinewave}, and one needs -to generalize it. The bends are too large to ignore replace them with a -straight line, but too small to retain both and retain their complexity. +figure~\ref{fig:sinewave} on page~\pageref{fig:sinewave}, and one needs to +generalize it. The bends are too large to ignore replace them with a straight +line, but too small to retain both and retain their complexity. \begin{figure}[h] \centering \includegraphics[width=52mm]{sinewave} \caption{Example river bend that should be generalized} - \label{pic:sinewave} + \label{fig:sinewave} \end{figure} -When one applies {\DP} to figure~\ref{pic:sinewave}, either both bends remain, +When one applies {\DP} to figure~\ref{fig:sinewave}, either both bends remain, or become a straight line, see table~\ref{tab:comparison-sinewave} on page~\pageref{tab:comparison-sinewave}. @@ -330,6 +331,9 @@ page~\pageref{tab:comparison-sinewave}. \label{tab:comparison-sinewave} \end{figure} +Ideally, the double-bend in figure~\ref{fig:sinewave} should be normalized to a +larger single-bend, similar to figure~ on page~. + \section{Related Work and future suggestions} \label{sec:related_work}