better sine wave
This commit is contained in:
parent
56090d23e3
commit
b73f71eb82
@ -1,6 +1,6 @@
|
||||
CROSSING=622916.858 6109272.561 626066.858 6111492.561 # xmin ymin xmax ymax
|
||||
ZEIMENA_TOLERANCES = 100 125 250 500 1000 2000 4000
|
||||
SINEWAVE_TOLERANCES = 1 2 3 4
|
||||
SINEWAVE_TOLERANCES = 1 20 30 40
|
||||
GEN = $(addsuffix .pdf, \
|
||||
$(addprefix sinewave-douglas-,$(SINEWAVE_TOLERANCES)) \
|
||||
$(addprefix sinewave-visvalingam-,$(SINEWAVE_TOLERANCES)) \
|
||||
@ -22,17 +22,17 @@ crossing-$(1)-$(2)-%.pdf: layer2img.py db/.faux_$(1)-$(2)-%
|
||||
endef
|
||||
|
||||
define gpkg2pdf
|
||||
$(2): $(1)
|
||||
./layer2img.py $(3) --infile=$(1) --outfile $(2)
|
||||
$(2).pdf: $(1).gpkg
|
||||
./layer2img.py $(3) --infile=$(1).gpkg --outfile $(2).pdf
|
||||
endef
|
||||
|
||||
$(eval $(call algo2img,sinewave,douglas,52x12))
|
||||
$(eval $(call algo2img,sinewave,visvalingam,52x12))
|
||||
$(eval $(call algo2img,zeimena,douglas,52x74))
|
||||
$(eval $(call algo2img,zeimena,visvalingam,52x74))
|
||||
$(eval $(call gpkg2pdf,sinewave.gpkg,sinewave.pdf,--size=52x15))
|
||||
$(eval $(call gpkg2pdf,zeimena.gpkg,zeimena.pdf,--size=148x210 --rect $(CROSSING)))
|
||||
$(eval $(call gpkg2pdf,zeimena.gpkg,crossing.pdf,--size=105x74 --clip $(CROSSING)))
|
||||
$(eval $(call gpkg2pdf,sinewave,sinewave,--size=52x15))
|
||||
$(eval $(call gpkg2pdf,zeimena,zeimena,--size=148x210 --rect $(CROSSING)))
|
||||
$(eval $(call gpkg2pdf,zeimena,crossing,--size=105x74 --clip $(CROSSING)))
|
||||
|
||||
sinewave.gpkg: sinewave.py
|
||||
./sinewave.py
|
||||
|
@ -12,7 +12,6 @@ INCH = 25.4 # mm
|
||||
|
||||
def plt_size(string):
|
||||
if not string:
|
||||
# using default matplotlib dimensions
|
||||
return None
|
||||
try:
|
||||
w, h = string.split("x")
|
||||
@ -48,7 +47,8 @@ def main():
|
||||
else:
|
||||
f = geopandas.read_file(args.infile)
|
||||
fig, ax = plt.subplots()
|
||||
fig.set_size_inches(args.size)
|
||||
if args.size:
|
||||
fig.set_size_inches(args.size)
|
||||
f.plot(ax=ax)
|
||||
if c := args.clip:
|
||||
ax.set_xlim(left=c[0], right=c[2])
|
||||
|
@ -257,25 +257,25 @@ page~\pageref{tab:comparison-sinewave}.
|
||||
\begin{figure}[h]
|
||||
\renewcommand{\tabularxcolumn}[1]{>{\center\small}m{#1}}
|
||||
\begin{tabularx}{\textwidth}{ p{1.5cm} | X | X | }
|
||||
Tolerance DP/VW &
|
||||
Douglas \& Peucker &
|
||||
Visvalingam-Whyatt \tabularnewline \hline
|
||||
Tolerance DP/VW &
|
||||
Douglas \& Peucker &
|
||||
Visvalingam-Whyatt \tabularnewline \hline
|
||||
|
||||
1/1 &
|
||||
\includegraphics[width=\linewidth]{sinewave-douglas-1} &
|
||||
\includegraphics[width=\linewidth]{sinewave-visvalingam-1} \tabularnewline \hline
|
||||
1/1 &
|
||||
\includegraphics[width=\linewidth]{sinewave-douglas-1} &
|
||||
\includegraphics[width=\linewidth]{sinewave-visvalingam-1} \tabularnewline \hline
|
||||
|
||||
2/4 &
|
||||
\includegraphics[width=\linewidth]{sinewave-douglas-2} &
|
||||
\includegraphics[width=\linewidth]{sinewave-visvalingam-2} \tabularnewline \hline
|
||||
20/400 &
|
||||
\includegraphics[width=\linewidth]{sinewave-douglas-20} &
|
||||
\includegraphics[width=\linewidth]{sinewave-visvalingam-20} \tabularnewline \hline
|
||||
|
||||
3/9 &
|
||||
\includegraphics[width=\linewidth]{sinewave-douglas-3} &
|
||||
\includegraphics[width=\linewidth]{sinewave-visvalingam-3} \tabularnewline \hline
|
||||
30/900 &
|
||||
\includegraphics[width=\linewidth]{sinewave-douglas-30} &
|
||||
\includegraphics[width=\linewidth]{sinewave-visvalingam-30} \tabularnewline \hline
|
||||
|
||||
4/16 &
|
||||
\includegraphics[width=\linewidth]{sinewave-douglas-4} &
|
||||
\includegraphics[width=\linewidth]{sinewave-visvalingam-4} \tabularnewline \hline
|
||||
40/1600 &
|
||||
\includegraphics[width=\linewidth]{sinewave-douglas-40} &
|
||||
\includegraphics[width=\linewidth]{sinewave-visvalingam-40} \tabularnewline \hline
|
||||
|
||||
\end{tabularx}
|
||||
\caption{{\DP} and {\VW} on example wave}
|
||||
|
@ -6,7 +6,7 @@ import geopandas as gpd
|
||||
from shapely.geometry import LineString, MultiLineString
|
||||
|
||||
INTERVAL = 0.1
|
||||
TAIL_LEN = 10
|
||||
TAIL_LEN = 7
|
||||
SINE_LEN = 7
|
||||
|
||||
TAILS = np.zeros(int(TAIL_LEN / INTERVAL))
|
||||
@ -17,7 +17,7 @@ def main():
|
||||
amplitude = (np.sin(sin_range * pi / 2) + 1)*2
|
||||
y = np.concatenate([TAILS, amplitude, TAILS])
|
||||
x = np.arange(-TAIL_LEN - pi/4, SINE_LEN + TAIL_LEN, INTERVAL)
|
||||
lines = LineString(zip(x, y))
|
||||
lines = LineString(zip(x*10, y*10))
|
||||
geom = MultiLineString([lines])
|
||||
df = gpd.GeoDataFrame(crs=CRS(3346))
|
||||
df['geometry'] = None
|
||||
|
Loading…
Reference in New Issue
Block a user