如何在MATLAB中计算直线和平面之间的角度?

时间:2014-04-17 14:28:00

标签: matlab math vector

points³中给出了五分ABCDE。如何计算第D-E行与ABC定义的平面之间的角度?

我理解这个问题,但我不知道如何在MATLAB中编程。我是MATLAB的新手,所以详细信息会非常有用。这就是我尝试过的,但它给了我错误的输出:

point1 = cross(B-A, C-A);
point2 = cross(D, E);
point3 = cross(point1, point2);
point4 = sqrt(A.*A + B.*B + C.*C);
point5 = sqrt(D.*D + E.*E)

point6 = point4*point5;
final  = point3 / point6

1 个答案:

答案 0 :(得分:0)

这里你去:

%// normal vector to plane ABC
N = cross(B-A, C-A);

%// angle between plane and line, equals pi/2 - angle between D-E and N
alpha = abs( pi/2 - acos( dot(E-D, N)/norm(N)/norm(E-D) ) );

%// you probably want it in degrees: 
alpha = rad2deg(alpha);