two sinewave variants

This commit is contained in:
Motiejus Jakštys 2020-05-27 13:53:51 +03:00
parent bd6e3647d5
commit bebe4cd3bf
2 changed files with 23 additions and 11 deletions

View File

@ -19,11 +19,18 @@ def write_file(args, geom):
def sinewave(args): def sinewave(args):
INTERVAL = 0.1 INTERVAL = 0.1
TAIL_LEN = 7
SINE_LEN = 7 if args.numwaves == 2:
TAIL_LEN, SINE_LEN = 7, 7
TAILS = np.zeros(int(TAIL_LEN / INTERVAL)) TAILS = np.zeros(int(TAIL_LEN / INTERVAL))
sin_range = np.arange(-pi/4, SINE_LEN, INTERVAL) sin_range = np.arange(-pi/4, SINE_LEN, INTERVAL) * pi / 2
amplitude = (np.sin(sin_range * pi / 2) + 1)*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]) y = np.concatenate([TAILS, amplitude, TAILS])
x = np.arange(-TAIL_LEN - pi/4, SINE_LEN + TAIL_LEN, INTERVAL) x = np.arange(-TAIL_LEN - pi/4, SINE_LEN + TAIL_LEN, INTERVAL)
lines = LineString(zip(x*10, y*10)) lines = LineString(zip(x*10, y*10))
@ -47,6 +54,7 @@ def parse_args():
parser.add_argument('-o', '--outfile', metavar='<file>', required=True) parser.add_argument('-o', '--outfile', metavar='<file>', required=True)
subparsers = parser.add_subparsers() subparsers = parser.add_subparsers()
sine = subparsers.add_parser('sine', help='Sine wave') 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) sine.set_defaults(func=sinewave)
rect = subparsers.add_parser('rect', help='Rectangle') rect = subparsers.add_parser('rect', help='Rectangle')
rect.add_argument('--bounds', type=float, nargs=4, metavar=BOUNDS) rect.add_argument('--bounds', type=float, nargs=4, metavar=BOUNDS)

View File

@ -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}. 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 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] \begin{figure}[h]
\centering \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. \cite{miuller1995generalization}. {\WM} encoded this process to an algorithm.
Imagine there are two small bends close to each other, similar to Imagine there are two small bends close to each other, similar to
figure~\ref{pic:sinewave} on page~\pageref{pic:sinewave}, and one needs figure~\ref{fig:sinewave} on page~\pageref{fig:sinewave}, and one needs to
to generalize it. The bends are too large to ignore replace them with a generalize it. The bends are too large to ignore replace them with a straight
straight line, but too small to retain both and retain their complexity. line, but too small to retain both and retain their complexity.
\begin{figure}[h] \begin{figure}[h]
\centering \centering
\includegraphics[width=52mm]{sinewave} \includegraphics[width=52mm]{sinewave}
\caption{Example river bend that should be generalized} \caption{Example river bend that should be generalized}
\label{pic:sinewave} \label{fig:sinewave}
\end{figure} \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 or become a straight line, see table~\ref{tab:comparison-sinewave} on
page~\pageref{tab:comparison-sinewave}. page~\pageref{tab:comparison-sinewave}.
@ -330,6 +331,9 @@ page~\pageref{tab:comparison-sinewave}.
\label{tab:comparison-sinewave} \label{tab:comparison-sinewave}
\end{figure} \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} \section{Related Work and future suggestions}
\label{sec:related_work} \label{sec:related_work}