-
Problem with vector math
HI, I’m having a lot of trouble with a 3d trigonometry problem. It’s not in after effects, but in a different software, Nuke, but as there are a few math wizards in here I thought I would give it a try in the Cow.
So if anybody could have a look and try to spot where my mistake is, I would really appreciate it.
Actually I know how to do it in AE so I would try to translate my problem to AE terms.The problem is, given 3 points in space a b c orient the resulting plane
what I do is:
1. get the vector normal to the plane with the following method
u = b – a
v = c – a
where u and v are two vectors that are on the plane
N = cross (u,v)
where N is the normal vector to the plane obtained from the result of the cross product of the two vectors u and v
This step would be the same in after effects.2. calculate the 3 angles using atan2
angle_x = atan2(N_z,N_x)
angle_y = atan2(N_y,N_x)
angle_z = atan2(N_y,N_z)
where N_x, N_y, N_z are the x y and z components of N
In after effecs I would just do lookAt(a, N) and be finished
3. convert the angles from radians to degrees.
4. In the application, in my case Nuke, but would be the same in AE, create a 3D solid with position values in the average point of a b c and with angle_x angle_y and angle_z as the orientation values.
So, In short would be how to orient a plane in 3d space without using the lookat function.
I’ve been trying to solve this for a week now and I can’t find where the problem is.
Thanks in advance
Jorge