Announcement

Collapse
No announcement yet.

Quaternions and other mathy doohickies

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Quaternions and other mathy doohickies

    Continued from a threadjack here: http://apolyton.net/forums/showthrea...threadid=76602

    Matricies in 3D transforms (as we use them in compsci land) require a full 3x3 matrix, or 9 floats.

    The unit quaternion:
    q = [ a b c d ] (so: a^2 + b^2 + c^2 + d^2 = 1)

    is equivalent to this 3x3 rotation matrix:
    Code:
    M(q) = [ (a^2+b^2-c^2-d^2)  (2bc-2ad)          (2bd+2ac)         ]
           [ (2bc+2ad)          (a^2-b^2+c^2-d^2)  (2cd-2ab)         ]
           [ (2bd-2ac)          (2cd+2ab)          (a^2-b^2-c^2+d^2) ]
    And that's quite literally how the computer stores it. Thus, Quaternions are much more efficient for 3D rotations, requiring 4 rather than 9 floats.

    Edit: Formatting of the matrix
    "The issue is there are still many people out there that use religion as a crutch for bigotry and hate. Like Ben."
    Ben Kenobi: "That means I'm doing something right. "

  • #2
    Hmmmm.. I guess all you need are four numbers for a rotation in R3 (3 for the vector around which you're rotating and one for the angle by which you rotate around it).
    "Beware of the man who works hard to learn something, learns it, and finds himself no wiser than before. He is full of murderous resentment of people who are ignorant without having come by their ignorance the hard way. "
    -Bokonon

    Comment


    • #3
      Quaternions are spiffy 'cause the composition of two rotations is simply the quaternion product. So if we wanted to rotate a vector a by a quaternion p, and then again by quaternion q, it's simply M(qp)a.

      IIRC, interpolations are also very easy. I don't remember those off the top of my head so we'll avoid those.
      "The issue is there are still many people out there that use religion as a crutch for bigotry and hate. Like Ben."
      Ben Kenobi: "That means I'm doing something right. "

      Comment


      • #4
        I've never dealt with quaternions personally. Just heard 'em described superficially a while back.

        On the subject of mathy doohickies, the group defined by the set of 1-1 maps of a set of 3 elements to itself where the product is defined as composition is isomorphic to the the group defined by the set of all symmetries of an equalateral triangle.
        "Beware of the man who works hard to learn something, learns it, and finds himself no wiser than before. He is full of murderous resentment of people who are ignorant without having come by their ignorance the hard way. "
        -Bokonon

        Comment


        • #5
          Originally posted by Ramo
          On the subject of mathy doohickies, the group defined by the set of 1-1 maps of a set of 3 elements to itself where the product is defined as composition is isomorphic to the the group defined by the set of all symmetries of an equalateral triangle.

          I'll keep that in mind.
          "The issue is there are still many people out there that use religion as a crutch for bigotry and hate. Like Ben."
          Ben Kenobi: "That means I'm doing something right. "

          Comment


          • #6
            You better.
            "Beware of the man who works hard to learn something, learns it, and finds himself no wiser than before. He is full of murderous resentment of people who are ignorant without having come by their ignorance the hard way. "
            -Bokonon

            Comment


            • #7
              A complex function is differentiable if and only if the partial of the real part of the function with respect to real part of the variable is the partial of the imaginary part of the fuction with respct to the imaginary part of the variable and the partial of the imaginary part of the function with respect to the real part of the variable is the negative of the partial of the real part of the function with respect to the imaginary part of the variable.

              Words to live by...
              "Beware of the man who works hard to learn something, learns it, and finds himself no wiser than before. He is full of murderous resentment of people who are ignorant without having come by their ignorance the hard way. "
              -Bokonon

              Comment


              • #8
                (this is somewhat related to the topic)
                I'm still kinda blown away at the performance of the NV30 chip -- it play with about 500 million polygons/second. 500,000,000. That's a staggering number.
                "The issue is there are still many people out there that use religion as a crutch for bigotry and hate. Like Ben."
                Ben Kenobi: "That means I'm doing something right. "

                Comment


                • #9
                  Originally posted by Ramo
                  On the subject of mathy doohickies, the group defined by the set of 1-1 maps of a set of 3 elements to itself where the product is defined as composition is isomorphic to the the group defined by the set of all symmetries of an equalateral triangle.
                  Why equilateral? Would this not be true for any triangle? (Although then the 3 elements would have to be non-identical presumably.)

                  Comment


                  • #10
                    Originally posted by Rogan Josh


                    Why equilateral? Would this not be true for any triangle? (Although then the 3 elements would have to be non-identical presumably.)
                    Nope. If the triangle isn't equilateral, it doesn't have as many symmetries.
                    The long list of nonsense

                    Comment


                    • #11
                      greek

                      I thoght english and finnish were the only allowed languages here
                      CSPA

                      Comment


                      • #12
                        The interesting thing about quadrature is that even though a high-order interpolating function will often wildly oscillate such that the infinity-norm increases as the function's order increases, these oscillations do not decrease the accuracy of quadrature, hence the reason that Runge-Kutta methods are still accurate for a high order so long as the function's high-order derivatives are well-behaved.
                        <p style="font-size:1024px">HTML is disabled in signatures </p>

                        Comment


                        • #13
                          3d transformations

                          thank god we don't need them!


                          *quietly reminds himself he's about to learn differential equations next simester*
                          urgh.NSFW

                          Comment


                          • #14
                            Originally posted by Zero-Tau
                            Nope. If the triangle isn't equilateral, it doesn't have as many symmetries.
                            Yes - that was what I was meaning about the 3 elements being non-identical. Or in other words, it would only be equilateral if the three elements are identical. Do you agree?

                            Comment


                            • #15
                              Originally posted by Ramo
                              I've never dealt with quaternions personally. Just heard 'em described superficially a while back.

                              On the subject of mathy doohickies, the group defined by the set of 1-1 maps of a set of 3 elements to itself where the product is defined as composition is isomorphic to the the group defined by the set of all symmetries of an equalateral triangle.
                              Also called the Dihedral group of order 6 (D6)
                              Also called the Symmetric Group of order 6 (S6)
                              Is by the way the smallest non-Abelian (non-commutative group)
                              for example, flipping a triangle over and then turning it counterclockwise 120 degree is not the same at turning it then flipping it....

                              Comment

                              Working...
                              X