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).

 Akzeptierte Antwort

Bruno Luong
Bruno Luong am 26 Jan. 2011
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,

Weitere Antworten (1)

Sean de Wolski
Sean de Wolski am 26 Jan. 2011

0 Stimmen

1 Kommentar

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

Melden Sie sich an, um zu kommentieren.

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by