Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!mit-eddie!wuarchive!zaphod.mps.ohio-state.edu!rpi!wrf From: wrf@mab.ecse.rpi.edu (Wm Randolph Franklin) Newsgroups: comp.graphics Subject: Re: how do i rotate around an arbitrary vector in 3D? Message-ID: <-MG^1P%@rpi.edu> Date: 14 Dec 90 20:43:14 GMT References: <18733@netcom.UUCP> Distribution: usa Organization: Rensselaer Polytechnic Institute, Troy NY Lines: 49 Nntp-Posting-Host: mab.ecse.rpi.edu In article <18733@netcom.UUCP> rodent@netcom.UUCP (Ben Discoe) writes: >i need to rotate a large set of points around an arbitrary axis, >specified as a vector. i know how to rotate around any base axis >(since it's just 2D rotation). If i had Mathematica around, i'd >just multiply the five rotation matrices involved, but i left >that behind when i left academia. For want of anything else, you might try: %A Wm. Randolph Franklin %T Efficient Rotation of an Object %J IEEE Trans. Computer %V C-32 %N 11 %D Nov. 1983 %P 1064-1067 I'll papermail a copy if you give me your address. IMHO methods, such as used by most texts, that first move the axis to the Z axis are brain damaged. Their conplexity is baroque and they're numerically ill conditioned for certain axes. Here is a vector formulation: q := cos(t)*p + (1-cos(t))*dotprod(a,p)*a + sin(t)*crossprod(a,p) 'a' is the NORMALIZED axis. This is a right hand rotation. Converting this to a matrix using Maple seems to give 2 [c + a1 (1 - c), a1 a2 (1 - c) - a3 s, a1 a3 (1 - c) + a2 s] 2 [a1 a2 (1 - c) + a3 s, c + a2 (1 - c), a2 a3 (1 - c) - a1 s] 2 [a1 a3 (1 - c) - a2 s, a2 a3 (1 - c) + a1 s, c + a3 (1 - c)] Here the point would be a column vector to the right of the matrix. I think this is right, and it agrees with FvDF&H, page 227, ex 5.15, so it probably is, sed caveat emptor lectorque. -- Wm. Randolph Franklin Internet: wrf@ecse.rpi.edu (or @cs.rpi.edu) Bitnet: Wrfrankl@Rpitsmts Telephone: (518) 276-6077; Telex: 6716050 RPI TROU; Fax: (518) 276-6261 Paper: ECSE Dept., 6026 JEC, Rensselaer Polytechnic Inst, Troy NY, 12180