Skip to content

Instantly share code, notes, and snippets.

@tinesubic
Created April 10, 2018 18:10
Show Gist options
  • Save tinesubic/31a63f084fc99c406014235b8cc72da8 to your computer and use it in GitHub Desktop.
Save tinesubic/31a63f084fc99c406014235b8cc72da8 to your computer and use it in GitHub Desktop.
vaja 2
def naloga2():
planes = np.load('letala.npy')
first = np.matrix(planes[0])
fig, pltarr = rv.plt.subplots(1)
ogCenter = (np.sum(first[:, 0]) / len(first), np.sum(first[:, 1] / len(first)))
matrix = rv.transAffine2D()
for i in range(int(360 / 5)):
matrix = rv.transAffine2D(iRot=5)
first = np.dot(rv.addHomCoord2D(first), matrix.transpose())
C = (ogCenter[0] - np.sum(first[:, 0]) / len(first), ogCenter[1] - np.sum(first[:, 1] / len(first)))
matrix = rv.transAffine2D(iTrans=C)
first = np.dot(rv.addHomCoord2D(first), matrix.transpose())
pltarr.plot(first[:, 0], first[:, 1], 'b')
first = np.matrix(planes[0])
pltarr.plot(first[:, 0], first[:, 1], 'r-', linewidth=4)
rv.plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment