SA-Kenan/04_Spurerkennung/dev/dev_Trafo.py
2022-05-09 20:30:26 +02:00

37 lines
611 B
Python

# -*- coding: utf-8 -*-
"""
Created on Thu Mar 31 19:36:39 2022
@author: Kenan
"""
import numpy as np
from matplotlib import pyplot as plt
points = np.array([[-2, -3, -1, 0],
[0, 1, -1, -2]])
x = points[0,:] # x coordinates
y = points[1,:] # y coordinates
f1 = plt.plot(x,y, 'ko')
plt.grid(True)
alpha = -45*np.pi/180
dx=-1
dy=-1
b = np.array([dx,dy])
#Verschiebung
x1 = x-dx
y1 = y-dy
plt.plot(x1,y1, 'bo')
plt.grid(True)
plt.axis('equal')
#Drehung
x_trafo = np.cos(alpha)*x1-np.sin(alpha)*y1
y_trafo = np.sin(alpha)*x1+np.cos(alpha)*y1
plt.plot(x_trafo,y_trafo, 'o')
plt.grid(True)