36 lines
853 B
Python
36 lines
853 B
Python
|
|
#!/usr/bin/env python
|
||
|
|
|
||
|
|
from pathlib import Path
|
||
|
|
|
||
|
|
import numpy as np
|
||
|
|
|
||
|
|
|
||
|
|
def rotation_matrix(sigma: float) -> np.ndarray:
|
||
|
|
|
||
|
|
radians = sigma * np.pi / 180.0
|
||
|
|
|
||
|
|
r11 = np.cos(radians)
|
||
|
|
r12 = -np.sin(radians)
|
||
|
|
r21 = np.sin(radians)
|
||
|
|
r22 = np.cos(radians)
|
||
|
|
|
||
|
|
R = np.array([[r11, r12, 0], [r21, r22, 0], [0, 0, 1]])
|
||
|
|
|
||
|
|
return R
|
||
|
|
|
||
|
|
|
||
|
|
A = np.array([[1.0, 1.0, 0.0], [1.0, 2.0, 1.0], [2.0, 1.5, 2.0], [0.0, 0.5, 3.0]])
|
||
|
|
|
||
|
|
with Path('expected_points.txt').open('w') as actual_points_output_file:
|
||
|
|
for line in A:
|
||
|
|
actual_points_output_file.write(' '.join((str(number) for number in line)) + '\n')
|
||
|
|
|
||
|
|
B = A.copy()
|
||
|
|
B *= 1.4
|
||
|
|
B -= 3
|
||
|
|
B = np.dot(B, rotation_matrix(90))
|
||
|
|
|
||
|
|
with Path('actual_points.txt').open('w') as actual_points_output_file:
|
||
|
|
for line in B:
|
||
|
|
actual_points_output_file.write(' '.join((str(number) for number in line)) + '\n')
|