What might be going wrong with my rotation of set of points as result look distorted? I have a set of points (X,Y). I calculate the mean (= "center of gravity") of them and subtract it from each point, then I rotate 10 degrees clockwise these and finally add back the mean. But the result seems somehow distorted if one looks attached pictures of original points as red squares and rotated points as blue x's. It is more obvious in the second picture where only rotated points are plotted with circles and center of rotation is marked by red. I try to highlight what I mean by distortion by marking it yellow color.
I don't see what goes wrong with my code. Is this normal? Can it be avoided?
# needed libraries
import numpy as np
import math
import matplotlib.pyplot as plt
# generating the original points
E_min = 379557
E_max = 379590
N_min = 6673711
N_max = 6673746
X = []
Y = []
for east in range(E_min, E_max,5):
for north in range(N_min, N_max,5):
X.append(east)
Y.append(north)
# angle of rotation 10 degrees
alfa = -10*math.pi/180
# calculating "center of gravity" = rotation point
X_mean = np.mean(X)
Y_mean = np.mean(Y)
# subtracting mean from original coordinates and saving result to X_new and Y_new
X_new = []
Y_new = []
for i in range(len(X)):
X_new.append(X[i] - X_mean)
Y_new.append(Y[i] - Y_mean)
# rotating coordinates from which mean has been subtracted
X_apu = [] #temporary help variable
Y_apu = [] #temporary help variable
for i in range(len(X)):
X_apu.append(math.cos(alfa)*X_new[i]-math.sin(alfa)*Y_new[i])
Y_apu.append(math.sin(alfa)*X_new[i]+math.cos(alfa)*Y_new[i])
# adding mean back to rotated coordinates
X_new = X_apu + X_mean
Y_new = Y_apu + Y_mean
# plotting data
plt.scatter(X_new, Y_new, c='b', marker='x', label='1')
plt.scatter(X, Y, c='r', marker='s', label='-1')**