Skip to content
Branch: master
Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


See for more information.

Efficiently Building a Matrix to Rotate One Vector to Another

Tomas Möller
Chalmers University of Technology

John F. Hughes
Brown University

This paper appears in issue Volume 4, Number 4.
Purchase this issue from the web site.


We describe an efficient (no square roots or trigonometric functions) method to construct the 3×3 matrix that rotates a unit vector f into another unit vector t, rotating about the axis f×t. We give experimental results showing this method is faster than previously known methods. An implementation in C is provided.

Author Information

Tomas Möller, Chalmers University of Technology, Dept of Computer Engineering412 96 Gothenburg, Sweden

John F. Hughes, Brown University, Computer Science Department, 115 Waterman Street, Providence, RI 02912


[May, 2003] The computation of h described on page 2 can be further optimized:

h = (1-c)/(1-c*c) = (1-c)/(v.v) = 1/(1+c)
Thanks to Gottfried Chen for pointing this out.

Source Code

The following C source file contains an implementation of the algorithm described in the paper, including the above optimization: fromtorot.c (3K HTML text)

BibTeX Entry

  author = "Tomas Möller and John F. Hughes",
  title = "Efficiently Building a Matrix to Rotate One Vector to Another",
  journal = "journal of graphics, gpu, and game tools",
  volume = "4",
  number = "4",
  pages = "1-4",
  year = "1999",
You can’t perform that action at this time.