In [1]:
from openglider.vector import transformation as trans
import numpy as np
from importlib import reload
reload(trans)
import matplotlib.pyplot as plt
In [4]:
rot = trans.Rotation(angle=np.pi/16)
move = trans.Translation(np.array([0, 0.1, 0]))
scale = trans.Scale(1.1)
reflect = trans.Reflection(np.array([1, 0, 0]))
combined = rot.dot(move)
In [5]:
vec4 = np.array([[0,0,0,1], [1,0,0,1], [1,1,0,1], [0,1,0,1], [0,0,0,1]])
vec3 = vec4.T[:-1].T
vec2 = vec3.T[:-1].T
In [7]:
combined.apply(vec2).T.T
Out[7]:
In [8]:
combined.apply(vec3).T[:2].T
Out[8]:
In [9]:
combined.apply(vec4).T[:2].T
Out[9]:
In [10]:
plt.figure(figsize=(10, 10))
plt.plot(*vec2.T[:2])
plt.plot(*scale.apply(vec2).T[:2])
plt.plot(*scale.dot(rot).apply(vec2).T[:2])
plt.plot(*scale.dot(rot.dot(move)).apply(vec2).T[:2])
plt.plot(*scale.dot(rot.dot(move.dot(reflect))).apply(vec2).T[:2])
plt.show()
In [13]:
combined(np.array([1,2,3]))
Out[13]:
In [14]:
np.zeros((10,3))
Out[14]:
In [ ]: