Vector rotation: Difference between revisions

From Citizendium
Jump to navigation Jump to search
imported>David E. Volk
(→‎= Hughes' method: in progress ...)
imported>David E. Volk
Line 2: Line 2:


== Methods ==
== Methods ==
A variety of methods can be used to determine the rotation matrix (in 3D or 4D space) needed to convert vector V<sub>1</sub> into vector V<sub>2</sub>.  Because they provide non-unique results, inverse trigonometry functions should only be used with great caution.  [[Quaternions]], a 4-dimensional approach can also be used, and this method has devoted followers and critics. Although everal 3D matrix rotation methods can be used, the method of Hughes (J. Graphics Tools, 2000) is particularly fast and avoids computational pitfalls inherent to many of the previous methods.
A variety of methods can be used to determine the rotation matrix (in 3D or 4D space) needed to convert vector V<sub>1</sub> into vector V<sub>2</sub>.  Because they provide non-unique results, inverse trigonometry functions should only be used with great caution.  [[Quaternions]], a 4-dimensional approach can also be used, and this method has devoted followers and critics. Although everal 3D matrix rotation methods can be used, the method of Hughes (J. Graphics Tools, 2000) is particularly fast, because it avoids time-consuming trigonometry and square root calculations, and avoids computational pitfalls of instability inherent to some of the previous methods.


=== Hughes' method ===
=== Hughes' method ===
Line 8: Line 8:
matrix by summing two reflections about either the X, Y or Z-axis, using the axis most orthogonal to the starting vector.   
matrix by summing two reflections about either the X, Y or Z-axis, using the axis most orthogonal to the starting vector.   


Take arbitrary starting unit vector V1 and desired final unit vector V2 defined as:
Take arbitrary starting unit vector V<sub>1</sub> and desired final unit vector V<sub>2</sub> defined as:


:<math> V_1 = (V_{1x} , V_{1y} , V_{1z})</math>
:<math> V_1 = (V_{1x} , V_{1y} , V_{1z})</math>

Revision as of 11:45, 8 March 2009

Vector rotations are widely used not only in the sciences, such as physics, chemistry and mathematics, but are critical for graphics computations in computer game programs. A typical example used in computer games would be calculating the graphics for a military tank rolling up a slanted hill, the relative rotation of the tank's turret, and the elevation of the tanks' barrel. Although each point of the tank could be calculated individually, a more economical method is to calculate a single rotation matrix for the entire tank and apply that solution to every current position of the tank as it rolls up the hill. Additional rotations are then used for the turret rotation by a second multiplication.

Methods

A variety of methods can be used to determine the rotation matrix (in 3D or 4D space) needed to convert vector V1 into vector V2. Because they provide non-unique results, inverse trigonometry functions should only be used with great caution. Quaternions, a 4-dimensional approach can also be used, and this method has devoted followers and critics. Although everal 3D matrix rotation methods can be used, the method of Hughes (J. Graphics Tools, 2000) is particularly fast, because it avoids time-consuming trigonometry and square root calculations, and avoids computational pitfalls of instability inherent to some of the previous methods.

Hughes' method

The sum of two reflections is a rotation, and the Hughes method relies on this fact to construct a rotation matrix by summing two reflections about either the X, Y or Z-axis, using the axis most orthogonal to the starting vector.

Take arbitrary starting unit vector V1 and desired final unit vector V2 defined as:

Choose vector P as the unit vector most orthogonal to V1 in the following manner: