Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Quaternion for 3D FPS Camera

  1. Oct 19, 2009 #1
    I'm trying to look how the formula made on this http://www.gamedev.net/reference/programming/features/quatcam/page2.asp" [Broken]. I want to know how this formula was derived. I tried to look on Quaternions and Rotation Sequences book but they use sin/cos which is so different on this.

    N.w = a.w*b.w - a.x*b.x - a.y*b.y - a.z*b.z
    N.x = a.w*b.x + a.x*b.w + a.y*b.z - a.z*b.y
    N.y = a.w*b.y - a.x*b.z + a.y*b.w + a.z*b.x
    N.z = a.w*b.z + a.x*b.y - a.y*b.x + a.z*b.w

    or maybe I'm lost?
     
    Last edited by a moderator: May 4, 2017
  2. jcsd
  3. Oct 19, 2009 #2

    D H

    User Avatar
    Staff Emeritus
    Science Advisor

    The quaternions form a number system under which addition and multiplication are each closed and associative. Addition is commutative in the quaternions but multiplication is not. There are many ways to look at quaternions as a whole. One view is that a quaternion comprises four real numbers under which multiplication is defined as in the original post. Another view, Hamilton's view, is that a quaternion comprises a real part and three distinct imaginary parts. Yet another is that a quaternion comprise a scalar real part and a vectorial (three vector) imaginary part: [itex]Q=(q_s, \mathbf q_v)[/itex].

    Denoting two quaternions as [itex]Q_1=(q_{1s}, \mathbf q_{1v}), Q_2 = (q_{2s}, \mathbf q_{2v})[/itex] then the quaternion product [itex]Q_1Q_2[/itex] can be written using the vector dot and cross products as

    [tex]Q_1Q_2 =
    (q_{1s}q_{2s} - \mathbf q_{1v}\cdot\mathbf q_{2v},\;\;
    q_{1s}\mathbf q_{2v} + q_{2s}\mathbf q_{1v} +
    \mathbf q_{1v}\times\mathbf q_{2v})[/tex]

    The book Quaternions and Rotation Sequences primarily focuses on unit quaternions. While the unit quaternions are useful (very useful) for representing rotations and transformation, there is a lot more to the quaternions than just the unit quaternions.
     
  4. Oct 20, 2009 #3
    Read it many times but I still didn't understand some of the things you've said. I just don't get it how it is made.

    Anyway, do you know what's the pre-requisite for quaternion topics? Is it Linear Algebra? Because I don't understand most of the topics in the book Quaternions and Rotation Sequences. Maybe I jump ahead so fast.
     
  5. Oct 20, 2009 #4

    D H

    User Avatar
    Staff Emeritus
    Science Advisor

    What is your mathematical background?

    Some more detailed questions:
    Do you understand complex numbers?
    Do you understand Euler's identity [itex]\exp(i\theta) = \cos \theta + i\sin\theta[/itex]?
    How much do you know about real and complex analysis?
    How much do you know about linear algebra?
     
  6. Oct 20, 2009 #5
    I guess so.

    Nope. What's that?

    Yes, I'm taking Calculus 2 class right now.

    So little. But I know how to use row reduced in matrices. Thanks to the opencourseware.

    Basing on what you've asked, I really did jump so fast. So what would you recommend to me? I really want to understand those quaternions for my 3D First Person Camera Engine.
     
  7. Oct 20, 2009 #6

    D H

    User Avatar
    Staff Emeritus
    Science Advisor

    That response means you do not really understand complex numbers.

    Whoa, Sarah!

    Here's a sequence in an undergrad math curriculum: Calculus I & II, Ordinary differential equations, Multivariable calculus, Introduction to analysis, Linear algebra, Real analysis, Complex analysis, Calculus of variations, Differential geometry, Abstract algebra (I, II, & III !!), General topology, Geometric topology, Algebraic topology, ...

    You'll run across the quaternions in the second or third abstract algebra class. You'll find out why they are useful for representing rotations when you take algebraic topology. Trying to understand quaternions when you have not yet finished Calc 2 is jumping the gun. Without the requisite intermediate knowledge all you will have will be a bunch of formulae that just don't make much sense.

    As a test, see how much sense you can make of this Wikipedia article: http://en.wikipedia.org/wiki/Charts_on_SO(3)

    This article is not quite so esoteric: http://en.wikipedia.org/wiki/Rotation_representation_(mathematics)


    If you insist on jumping the gun, I suggest checking out a text on abstract algebra or modern algebra. Mine gets to the quaternions on page 503.
     
    Last edited: Oct 20, 2009
  8. Oct 20, 2009 #7
    OMG. I'm jumping so far. Do I really need to take "Introduction to analysis->......->Differential geometry" for me to understand Abstract algebra very much? Well I hope I can do that by myself because my curriculum only has until Multivariable calculus (I'm studying Multivariable calculus some time. Vectors... Matrices.. 18.02 in MIT opencourseware helps me so much.).

    Curriculum here sucks so bad. I'm doom! I'm 18 and I barely know Multivariate calculus. Am I a failure? lol

    Honestly, I really thought Calculus 2 is enough to learn quaternions. I guess I need to finish the lecture notes I found for multivariate so I can move to the next math.

    Btw, thanks for the help. Now I realized that my knowledge in math is not enough for my target thesis project.
     
    Last edited: Oct 20, 2009
  9. Oct 20, 2009 #8
    No sarah! I have no idea what all those other people are saying: They are saying sth like" You need to understand how natural numbers are defined to use them". Of course this is nonsens- needing abstract algebra for understanding Quaternions!? No way.

    I know that book u are talking about is accessible,- it doesnt " even" talk about groups, however, this doesn't mean you are at the appropriate level. If you know Linear algebra(!) and calculus well, you wont have any problems.

    To come to your opening post:
    How you multiply quaternions is explained on several pages on the internet,- the one you mention uses the "most simplified" fprm, -working out the dot/cross product. I guess you are familiar with dot/cross products.?
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Quaternion for 3D FPS Camera
  1. Quaternion confusion (Replies: 3)

  2. Averaging Quaternions (Replies: 15)

Loading...