points in space
Peter J. Floriani, Ph.D.
floriani at epix.net
Tue Jan 14 02:28:54 EST 1997
c07craig at sfsu.edu wrote:
>Suppose we know vector PQ which is in a plane in space.
>We also know angle theta, which is the angle between PQ and PR.
>PR is also in the same plane as PQ, and the unit length
>of PQ is the same as PR. So, given all this,
>how do we find vector PR?
>In other words, how do we solve for point R in three dimensional space?
>Another way to put it is how can one use a polar coordinate
>system that is in an arbitrary plane in space?
This is rather straightforward with vector algebra,
and is supplied below.
If you need further help, check out a vector algebra text.
Peter J. Floriani, Ph.D.
floriani at epix.net
"I have often thanked God for the telephone." G. K. Chesterton, 1910
-----------------------------------------------------
Given the following:
N is the vector normal to the given plane
Q is the vector in the plane along the axis of the polar system
P (a point in the plane) is the pole
Let [S] be the matrix which rotates <0,0,1> to N.
Let [Z] be the matrix which rotates N to <0,0,1>.
Let [T] be the matrix which rotates <1,0,0> to Q*[Z].
Thus, [T]*[S] rotates the xy plane to the NQ system.
So, given a polar coordinate (r,theta),
to find it in the new system, compute
<r*cos(theta),r*sin(theta),0> * ([T]*[S])
This is the vector R desired.
Or, to get the point in 3-space, merely offset this by P.
-----------------------------------------------------
To rotate v to w, compute a 3x3 matrix in the following way:
A. Rotate v to <d,0,0> where d=|v| by
1. rotate about x axis so v' lies in the xy plane.
2. rotate about z axis so v'' lies in the x axis.
and record the operation in r.
Details:
If v is <anything,0,0> then r is the identity matrix.
Otherwise, let v=<x,y,z> and compute:
d=sqrt(x*x+y*y+z*z)
q=sqrt(y*y+z*z)
r[1,1]=x/d
r[1,2]=-q/d
r[1,3]=0
r[2,1]=y/d
r[2,2]=x*y/(d*q)
r[2,3]=-z/q
r[3,1]=z/d
r[3,2]=x*z/(d*q)
r[3,3]=y/q
B. Rotate <d,0,0> to w
3. rotate about z axis
4. rotate about x axis
and record the operation in s.
Details:
If w is <anything, 0,0> then s is the identity matrix.
Otherwise, let w=<x,y,z> and compute:
d=sqrt(x*x+y*y+z*z)
q=sqrt(y*y+z*z)
s[1,1]=x/d
s[1,2]=y/d
s[1,3]=z/d
s[2,1]=-q/d
s[2,2]=x*y/(d*q)
s[2,3]=x*z/(d*q)
s[3,1]=0
s[3,2]=-z/q
s[3,3]=y/q
C. Finally, the desired matrix is r*s.
More information about the Comp-bio
mailing list