Pythonのmatplotlibを使って描いた三角形を回転させる
import numpy as np import matplotlib.pyplot as plt #三角形の頂点(内角が、30°、60°、90°の三角形) p = np.matrix([[0, np.sqrt(3), np.sqrt(3), 0], [0, 0, 1, 0]]) #変換行列(反時計回りに30°回転) th = np.radians(30) A = np.matrix([[np.cos(th), np.sin(-th)], [np.sin(th), np.cos(th)]]) #変換 p2 = A * p p = np.array(p) p2 = np.array(p2) plt.plot(p[0], p[1]) plt.plot(p2[0], p2[1]) plt.axis('equal') plt.show()