1
   

Vector rotation

 
 
stuh505
 
Reply Sun 9 Oct, 2005 12:13 pm
[This is a restating of the other post where I did not describe things well]

Given a normalized vector V1, what rotation(s) [x,y,z] must be applied to make this vector point in the direction of another normalized vector V2?

* I have pluralized rotations because it may be that the problem is simpler to solve by applying a series of [x,y,z] rotations than one single rotation.

* Normalized means the length is 1

* You can assume we are talking about the traditional definition of a vector, which does not have a starting point but is just a direction value.
  • Topic Stats
  • Top Replies
  • Link to this Topic
Type: Discussion • Score: 1 • Views: 846 • Replies: 6
No top replies

 
raprap
 
  1  
Reply Sun 9 Oct, 2005 02:09 pm
Rotation matrices in three space are the product of three matrices, one matrix is a clockwise rotation about each axis.

From mathworld

In, rotations about the x-, y-, and z-axes in a clockwise direction when looking towards the origin give the matrices you apply the angle of rotation around the axis using a R2 rotation matrix holding that axis as identity. The product of these three matrices is the rotation matrix in three space. Your vectors can be rotated once you've got the angles between the vectors projected on the plane of each axis.

Rap
0 Replies
 
stuh505
 
  1  
Reply Sun 9 Oct, 2005 02:59 pm
Yes, I know...but actually doing that is not so easy.

I tried this but it's not right:

yrot = asin(z1/sqrt(x1^2+z1^2))-asin(z2/sqrt(x2^2+z2^2))

zrot = asin(y1/sqrt(x1^2+y1^2))-asin(y2/sqrt(x2^2+y2^2))

I've tried a bunch of times to work it out but can't get it right
0 Replies
 
markr
 
  1  
Reply Sun 9 Oct, 2005 09:17 pm
http://www.mines.edu/~gmurray/ArbitraryAxisRotation/ArbitraryAxisRotation.html
http://astronomy.swin.edu.au/~pbourke/geometry/rotate/
http://www.mrao.cam.ac.uk/~clifford/introduction/intro/node9.html
0 Replies
 
stuh505
 
  1  
Reply Sun 9 Oct, 2005 10:55 pm
markr,

The links you have provided are about transformation matrices, which are used to rotate geometric vertices about an axis.

Although that is something else that I am doing, that is not what this question is about. I have read over those articles, and there doesn't seem to be anything pertinent to this question...except perhaps for equations 3.3 to 3.6 of the last link. The text here states a similar problem (rotating vector A into vector B) but I cannot understand what the equations are representing, they appear to be too simple to be actually correct.

The equations I provided above are correct, except that there should be an additional equation for zrot following the same logic using soh cah toa.

However, it is more complicated than simply those equations because of special cases such as dividing by zero, etc.

Using the vector dot product in the [x,y], [y,z], and [x,z] planes we could determine the magnitude of the rotation without any special cases...but this does not tell us the sign!!

So far, I am still unable to construct a working algorithm
0 Replies
 
markr
 
  1  
Reply Mon 10 Oct, 2005 12:44 am
I'd use atan instead of asin:
xrot = atan(z1/y1) - atan(z2/y2)

I'd also write my own arctan(x, y) function that determines the proper adjustments to atan(abs(y/x)) based on the quadrant of the point. It will also eliminate the divide by zero issue if you check for that before calling atan().
0 Replies
 
markr
 
  1  
Reply Mon 10 Oct, 2005 02:12 pm
Better yet, use the atan2 function if your compiler has it.
0 Replies
 
 

Related Topics

Evolution 101 - Discussion by gungasnake
Typing Equations on a PC - Discussion by Brandon9000
The Future of Artificial Intelligence - Discussion by Brandon9000
The well known Mind vs Brain. - Discussion by crayon851
Scientists Offer Proof of 'Dark Matter' - Discussion by oralloy
Blue Saturn - Discussion by oralloy
Bald Eagle-DDT Myth Still Flying High - Discussion by gungasnake
DDT: A Weapon of Mass Survival - Discussion by gungasnake
 
  1. Forums
  2. » Vector rotation
Copyright © 2024 MadLab, LLC :: Terms of Service :: Privacy Policy :: Page generated in 0.03 seconds on 05/01/2024 at 04:32:58