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

 Réponse acceptée

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,

Plus de réponses (1)

Sean de Wolski
Sean de Wolski le 26 Jan 2011

0 votes

1 commentaire

konak
konak le 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!

Connectez-vous pour commenter.

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by