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

 Respuesta aceptada

Bruno Luong
Bruno Luong el 26 de En. de 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,

Más respuestas (1)

Sean de Wolski
Sean de Wolski el 26 de En. de 2011

0 votos

1 comentario

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

Iniciar sesión para comentar.

Productos

Preguntada:

el 26 de En. de 2011

Community Treasure Hunt

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

Start Hunting!

Translated by