Буду очень признателен за вашу помощь.
Если я хочу задать свой вопрос более точно, как следует ли рассчитывать значения Ax, Ay и Az?
Код: Выделить всё
import numpy as np
points = np.array([[0.36266313,0.70320135,0.88975275],
[0.26227164,0.32188661,0.39514979],
[0.26100571,0.63643259,0.20245194],
[0.25701545,0.59125069,0.80146842],
[0.23185588,0.19422526,0.68689653]])
point1, point2 = points[0], points[2]
points = points - point1
point2 = point2 - point1
point1 = point1 - point1
def rotate_points_around_point(points, angle_degrees, axis, center_point):
translated_points = points - center_point
angle_radians = np.radians(angle_degrees)
rotation_matrix = {
'x': np.array([[1, 0, 0],
[0, np.cos(angle_radians), -np.sin(angle_radians)],
[0, np.sin(angle_radians), np.cos(angle_radians)]]),
'y': np.array([[np.cos(angle_radians), 0, np.sin(angle_radians)],
[0, 1, 0],
[-np.sin(angle_radians), 0, np.cos(angle_radians)]]),
'z': np.array([[np.cos(angle_radians), -np.sin(angle_radians), 0],
[np.sin(angle_radians), np.cos(angle_radians), 0],
[0, 0, 1]])
}
rotated_points = np.dot(translated_points, rotation_matrix[axis].T)
rotated_points = rotated_points + center_point
return rotated_points
# ======== Question ========
Ax = 96
Ay = -3.0626
Az = -8.38675
# ======== Question ========
points = rotate_points_around_point(points, Ax, "x", point1)
points = rotate_points_around_point(points, Ay, "y", point1)
points = rotate_points_around_point(points, Az, "z", point1)
print(points)
Код: Выделить всё
[[ 0. 0. 0. ]
[-0.004306 0.538135 -0.332422]
[ 0. 0.697979 0. ]
[-0.084459 0.11303 -0.107608]
[-0.066404 0.267493 -0.49128 ]]
Подробнее здесь: https://stackoverflow.com/questions/790 ... the-y-axis