From 6d9897652fc4952fe518d917ba8b0bb46c56b460 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Motiejus=20Jak=C5=A1tys?= Date: Tue, 26 May 2020 11:56:58 +0300 Subject: [PATCH] sine wave with shapes --- II/Referatas/sinewave.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/II/Referatas/sinewave.py b/II/Referatas/sinewave.py index 74f1ca5..3f540ee 100755 --- a/II/Referatas/sinewave.py +++ b/II/Referatas/sinewave.py @@ -1,19 +1,22 @@ #!/usr/bin/python +from math import pi from pyproj import CRS import numpy as np import geopandas as gpd from shapely.geometry import LineString -INTERVAL = 0.5 +INTERVAL = 0.1 TAIL_LEN = 4 SINE_LEN = 7 +TAILS = np.zeros(int(TAIL_LEN / INTERVAL)) + def main(): - tails = np.zeros(int(TAIL_LEN / INTERVAL)) - amplitude = np.sin(np.arange(0, SINE_LEN, INTERVAL)) - y = np.concatenate([tails, amplitude, tails]) - x = np.arange(-TAIL_LEN, SINE_LEN+TAIL_LEN, INTERVAL) + sin_range = np.arange(-pi/4, SINE_LEN, INTERVAL) + amplitude = np.sin(sin_range * pi / 2) + 1 + y = np.concatenate([TAILS, amplitude, TAILS]) + x = np.arange(-TAIL_LEN - pi/4, SINE_LEN + TAIL_LEN, INTERVAL) geom = LineString(zip(x, y)) df = gpd.GeoDataFrame(crs=CRS(3346)) df['geometry'] = None