如何使用旋转角度和轴来旋转 3D 平面?

How can I use the rotation angle and axis to rotate a 3D plane?

我有两个平面并且知道平面的方程和法线。我想将蓝色平面的点旋转到橙色平面。

我用法线得到旋转轴和旋转角度,用罗德里格斯旋转公式得到旋转矩阵。

将蓝色平面的法线乘以旋转矩阵,有效,法线等于橙色平面的法线。但是在蓝色平面中乘以点坐标时,结果不是我想要的。我忽略了哪一部分?

蓝色和橙色窗格:

旋转后:

  blue plane:  0.4273x-0.0075y-0.9041z+13.5950=0;
      normal:  [0.4273;-0.0075;-0.9041]
orange plane: -0.8111x+0.0019y-0.5849z+7.8024=0;
      normal:  [-0.811;0.0019;-0.5849]
theta = acos(dot(n_left,n_right)/(norm(n_left)*norm(n_right)));
theta = 1.3876;
axis = cross(n_left,n_right) / norm(cross(n_left,n_right));
axis = (-0.0062;-1.0000;0.0053);
C_matrix = [0     -axis(3) axis(2); 
            axis(3)  0     -axis(1);  
            -axis(2) axis(1)  0];  %cross product matrix
R = diag([1 1 1]) + (1-cos(theta))*C_matrix^2 + sin(theta)*C_matrix;
R = [0.1823,-0.0001,-0.9833;
    0.0104,0.9999,0.0018;
    0.9832,-0.0105,0.1822];
after_rotation = R*blue_points;
  one point of blue plane: [-1.1056;-0.2270;14.8712]
           after rotation: [14.8197;-0.4144;-1.6222]
one point of orange plane: [-0.2366;-0.4296;14.9292)]

我有一个新问题,和以前一样。但是我还是不能完美解决。你能告诉我我应该填写哪一部分吗?

left plane: 0.0456x+0.0016y-0.999z+1.1333=0;
normal: [0.0456,0.0016,-0.999]
right plane: -0.0174x+0.0037y-0.998z+0.9728=0;
normal: [-0.0174,0.0037,-0.9998]
rotation matrix:
R = [0.9980   -0.0001    0.0630
    0.0003    1.0000   -0.0021
   -0.0630    0.0021    0.9980]
one point on the left plane:[-2.4 -0.6446 1.0031]
after rotate: [-2.4012 -0.6446 0.9916]
one point on the right plane:[0.4095 -0.6447 0.9634]

轮换前:

旋转后:

旋转后,我猜他们在同一平面上,但他们没有相遇。我应该怎么做才能使黄色平面的右侧与蓝色平面的左侧相交?我应该围绕哪个点旋转?起源?非常感谢您的回答!

您当前的旋转执行绕原点的旋转。

如果您希望平面重合,请围绕两个平面之间的共享点执行旋转(假设原始平面不平行)。

你可以从2个平面方程中找到一个共享点:

% Store data about plane
n_left = [0.43273 -0.0075 -0.9041];
n_left = n_left/norm(n_left);
b_left = -13.5950;

n_right = [-0.8111 0.0019 -0.5849];
n_right = n_right/norm(n_right);
b_right = -7.8024;

% Find a point on both planes
shared_point = [n_left; n_right]\[b_left; b_right];

要围绕此 shared_point 而不是原点旋转,请执行此操作:

% Transform points
after_rotation = R*(blue_points - shared_point) + shared_point;