Angle between two planes given xyz coordinate data from each plane

조회 수: 3 (최근 30일)
I have 4 points in one plane and 3 points on another plane. How do I use this data to calculate the angle between the two planes generated by the xyz coordinates? Here is what I have tried so far, but I don't get a number as an answer. Any help would be appreciated!
%Proximal Plane
P1 = [1,-1,3];
P2 = [2,3,4];
P3 = [-5,6,7];
normal = cross(P1-P2, P1-P3);
syms x y z
P_p = [x,y,z]
realdot = @(u, v) u*transpose(v);
planefunction = realdot(normal, P_p-P1);
%Distal Plane
P4 = [4,-2,4];
P5 = [1,7,5];
P6 = [-3,5,9];
normal2 = cross(P4-P5, P4-P6);
syms x1 y1 z1
P_d = [x1,y1,z1]
realdot = @(u, v) u*transpose(v);
planefunction2 = realdot(normal2, P_d-P4);
angle = acosd((realdot(P_p,P_d)/norm(P_p)*norm(P_d)))

채택된 답변

David Hill
David Hill 2022년 9월 8일
P1 = [1,-1,3];
P2 = [2,3,4];
P3 = [-5,6,7];
normal = cross(P1-P2, P1-P3);
P4 = [4,-2,4];
P5 = [1,7,5];
P6 = [-3,5,9];
normal2 = cross(P4-P5, P4-P6);
Angle=acosd(abs(sum(normal.*normal2))/norm(normal)/norm(normal2));
  댓글 수: 2
James Tursa
James Tursa 2022년 9월 9일
Or
Angle = atan2(norm(cross(normal,normal2)),dot(normal,normal2));
Gabriella Sandberg
Gabriella Sandberg 2022년 9월 9일
If I use the tan function over the cos function, would it calculate the same angle? Thank you both for your input.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Conversion Between Symbolic and Numeric에 대해 자세히 알아보기

태그

제품


릴리스

R2019b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by