PDA

View Full Version : how to fing rotation angles from 3d points



velkro
11-17-2000, 11:47 AM
i was wondering if anybody knew how to fing the rotation angles of a line from any given point in 3d space to another given point in 3d space given the two points but no angles.
in other words, i have a point in space and i want to rotate to another point in space but i only have the coordinates of the two points. i want to find the angles to rotate the the line in between them if one of the points is the origin.
sample code would also be appreciated. thanks in advance
velkro

shawge
11-17-2000, 12:19 PM
I believe that you want the dot product. From my math book:

A = vector A, B = vector B, |A| = magnitude of vector A, |B| = magnitude of vector B

The dot product of two vectors A=<a_1,a_2,a_3> and B=<b_1,b_2,b_3> is given by

A dot B = a1*b1 + a2*b2 + a3*b3

An equivalent definition of the dot product is
A dot B = |A|*|B|*cos(theta)

where theta is the angle between the two vectors.

QED