Ho do I calculate the angle between two 3d triangles?

Is it possible to compute angle between two 3d triangles always sharing two vertices?
Let's assume triangle1 consists of three points
P1=(x1,y1,z1), P2=(x2,y2,z2), and P3=(x3,y3,z3).
Triangle2 consists of the following three points
P1=(x1,y1,z1), P2=(x2,y2,z2), and P3=(x4,y4,z4).

 채택된 답변

Bruno Luong
Bruno Luong 2011년 1월 26일

1 개 추천

P1=randn(3,1)
P2=randn(3,1)
P3=randn(3,1)
P4=randn(3,1)
E=P1-P2 % edge
Q = null(E')
v1 = Q'*(P3-P1)
v2 = Q'*(P4-P1)
theta1 = atan2(v1(2),v1(1))
theta2 = atan2(v2(2),v2(1))
theta = mod(theta1-theta2,2*pi) % radian
% Bruno
Note that there is always an ambiguity of the sign of the angle when working on 3D,

추가 답변 (1개)

Sean de Wolski
Sean de Wolski 2011년 1월 26일

0 개 추천

댓글 수: 1

konak
konak 2011년 1월 26일
yes, indeed, know i wanted to check whether what i get is similar to what i would obtain using matlab. thanks a lot!

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

카테고리

제품

질문:

2011년 1월 26일

Community Treasure Hunt

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

Start Hunting!

Translated by