def project(p12,p10):
norm = np.linalg.norm(p12)**2
ret = np.dot(p10,p12)/norm
return an[0]+p12*ret
a = []
a.append(map(int, raw_input().split()))
an = np.array(a).reshape(2,2)
p12 = an[1]-an[0]
n = input()
for i in range(n):
a = []
a.append(map(int, raw_input().split()))
for aa in a:
hn = np.array(aa).reshape(1,2)
p10 = hn[0]-an[0]
print(p12,p10,aa)
projection = project(p12,p10)
print(p10 + (projection - p10) * 2.0)
More than 5 years have passed since last update.
Register as a new user and use Qiita more conveniently
- You get articles that match your needs
- You can efficiently read back useful information
- You can use dark theme
List of users who liked
10