Поверните вектор вокруг плоскости уравнения

#python

#питон

Вопрос:

Я пытаюсь повернуть вектор вокруг плоскости уравнения. Однако, когда я поворачиваю вектор, то есть на 90 градусов, вектор поворачивается под другим углом. Я хочу, чтобы вектор, который не указывает ни на одну точку, был направлен на зеленую точку, которая должна поворачиваться на 90 градусов.

 import numpy as np import matplotlib.pyplot as plt from scipy.spatial.transform import Rotation as R import math  fig = plt.figure() ax = fig.add_subplot(projection = "3d")  # points to construct plane point1 = 10, 10 , 0 point2 = 15, 15, 10 point3 = 15, 5, 0  point1 = np.array(point1) point2 = np.array(point2) point3 = np.array(point3)  # These two vectors are in the plane v1 = point2 - point1 v2 = point3 - point1  # the cross product is a vector normal to the plane cp1 = np.cross(v1, v2) a1, b1, c1 = cp1  # This evaluates a * x3   b * y3   c * z3 which equals d d1 = np.dot(cp1, point3)  print('The equation plane is {0}x   {1}y   {2}z = {3}'.format(a1, b1, c1, d1))  # Create grid xlim = np.linspace(-5, 20, 100) ylim = np.linspace(-5, 20, 100) X, Y = np.meshgrid(xlim, ylim)  Z_sag = (d1 - a1 * X - b1* Y) / c1   # Rotate the vector between point 1 and 2, 90 degrees around the equation plane vec = [v1[0], v1[1], v1[2]]  rotation_degrees = 90 rotation_radians = np.radians(rotation_degrees) rotation_axis = np.array([a1, b1, c1])  rotation_vector = rotation_radians * rotation_axis rotation = R.from_rotvec(rotation_vector) rotated_vec = rotation.apply(vec)  # Set labels ax.set_xlabel('x') ax.set_ylabel('y') ax.set_zlabel('z')   # set Limits ax.set_xlim([-10, 20]) ax.set_ylim([-10, 20]) ax.set_zlim([-10, 20])  # Create plane ax.plot_wireframe(X ,Y, Z_sag, rstride = 15, cstride = 15, color='yellow') # Plot vector between point 1 and 2 ax.quiver3D(point1[0], point1[1], point1[2], v1[0], v1[1], v1[2]) # plot rotated vector ax.quiver3D(point1[0], point1[1], point1[2], rotated_vec[0], rotated_vec[1], rotated_vec[2]) # plot Points ax.scatter3D(point1[0], point1[1], point1[2]) ax.scatter3D(point2[0], point2[1], point2[2]) ax.scatter3D(point3[0], point3[1], point3[2])