Suppose we have several points located in three-dimensional space. Now, we specify two points, named point1 and point2. To simplify the problem, we consider these two points as a line. Now we move point1 to the origin. This translation is such that all the points are displaced accordingly. Now, all points must be rotated so that point2 is exactly on the Y-axis, meaning its x and z coordinates should be zero. But what specific calculations need to be performed to determine the directions in which all these points should rotate so that point2 is precisely positioned on the Y-axis? I would really appreciate your help. If I want to ask my question more precisely, how should the values of Ax, Ay, and Az be calculated? 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) Result: [[ 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 ]] I value the insights and guidance you provide. Continue reading...