Jump to content
  • Advertisement

mathematical

Member
  • Content Count

    55
  • Joined

  • Last visited

Community Reputation

504 Good

About mathematical

  • Rank
    Member

Personal Information

  • Interests
    Programming

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. mathematical

    Quaternions, how does ki = j?

    I think i got it.... \( j(ijk) = -j \rightarrow ji(jk) = -j \rightarrow ji = -j(jk) \rightarrow ji = -j^{2}k \rightarrow ji^{2} = -j^{2}ki \rightarrow -j = -j^{2}ki \rightarrow -j = -ki \rightarrow \mathbf{j = ki} \) Does that look about right? I think going from ji = -j2k to ji2 = -j2ki should be good, this is the step i was missing. But after looking at this for so many hours, i'm not 100% confident...
  2. mathematical

    Quaternions, how does ki = j?

    So far i can prove that \( i = jk \) and that \(k = ij \), i can't prove that \( j = ki \). Also, can't sleep thinking about this. Here is what i have: \( ijk = -1 \rightarrow i(ijk) = -i \rightarrow i^{2}jk = -i \rightarrow -jk = -i \rightarrow \mathbf{jk = i} \) j = ki? \( ijk = -1 \rightarrow k(ijk) = -k \rightarrow (kij)k = -k \rightarrow k = -k(kij) \rightarrow k = -k^{2}ij \rightarrow \mathbf{k = ij} \)
  3. mathematical

    Quaternions, how does ki = j?

    Edit, this post was dumb, removing it and going to sleep.
  4. mathematical

    Quaternions, how does ki = j?

    I'm trying to understand the steps needed to prove that ij = -ji = k, etc.... Like i get that i can flip ji to ij and make the sign flip, but i don't get why (well, i kind of do now) Trying to really zero in on the "how does this work" bits
  5. mathematical

    Quaternions, how does ki = j?

    That makes sense, so: ijk = -1 -> j(ijk) = -j -> jijk = -j -> (ji)jk = -j -> jk = -j2i -> k = -ji -> ji = -k What i'm not 100% confident in is how i go from j(ijk) to -ij2k, this is what i think: ijk = -1 -> j(ijk)= -j -> j = -j(ijk) -> j = -ij2k Is that right or am i missing a step? When i move (ijk) over, the negative term applies to everything, not just j, right?
  6. mathematical

    Quaternions, how does ki = j?

    Looking at ijk = -1, i'm trying to fully understand how to find individual values. i appears easy: i(ijk) = -1(i) -> i2jk = -i -> -jk = -i -> jk = i Trying to find j is problematic: j(ijk) = -1(j) -> ij2k = -j -> -ik = -j -> ik = j That's wrong, it should be ki = j and ik = -j Can someone point out what i'm doing wrong here? It seems that the ij2k = -j -> -ik = -j step is wrong, but i don't know how to handle i-k = -j Am i just free to arbitrarily re-arrange it to -ki = -j, that seems wrong somehow....
  7. mathematical

    Quaternion, why divide angle by 2?

    Thanks everyone for helping, i think this post is resolved @Maciej Mizerski between your two posts i gained a lot of insight into how quaternions work, tough it's much less visual than i'd hoped 😛 Your insight was very helpful and much appreciated.
  8. mathematical

    Quaternion, why divide angle by 2?

    This is a bit more confusing than i expected it to be. @Scouting Ninja If i'm getting your example correct, you have two angles on the circle ~135 and ~225. When projected onto a 1D line, both angles look the same, even tough they are not. In this example, if we where to divide the angle by 2 it would effectively eliminate the bottom hemisphere of the circle, mapping 135 to 67.5 and 225 to 112.5. This would make it so all 360 degrees are mapped to the upper hemisphere of the circle, meaning if we where to project it onto a straight line, every value would be visible. Did i get that right? Expanding that to quaternions would make a lot of sense. @JoeJ I'm still working trough visualizing the numbers you provided, will probably have some question later. @Maciej Mizerski That's a bit above my head. I was not aware that i,j,k represented rotations of 180. I'm not sure how eliminating the divide by 2 would cause them to be 90 instead of 180... What i think i get from your explanation is that when dividing theta / 2, then sin(180/2) = 1, so at 180 degrees i = 1, I'm not really grasping the significance of this.... I've read a few sources that explain the need to divide by 2 as a result of conjugation, so multiplying a vector would be \(qpq^{-1}\), that is q needs to rotate p half way, then q-1 needs to go the other half. One of the most intuitive explanations i heard about this is that we're not just rotating on one plane, rather both the real and vector parts of the quaternion rotate the vector. So you want to rotate half way, then invert the quat and rotate the other half. Inverting will undo one of the planes that we're rotating on, putting the vector back on a 3D plane.... I'm going to write some code tomorow to try and visualize both qp and (qp)q', see if i can maybe make sense of that.
  9. mathematical

    Quaternion, why divide angle by 2?

    In your example, the normal of the plane were reflecting about is the axis of rotation?
  10. I'm trying to understand why the formula for creating a quaternion from an axis angle representation divides theta by 2: \(cos(\theta / 2), \hat{v}sin(\theta/2)\) As far as i understand this is because quaternions do double cover? IE a quat represents 720 degrees of rotation, not just 360? But that doesn't make much sense to me, since cos(45) = cos(45+360) = cos(405). Like any input to cos is going to yield the same output. So yeah, i don't get this, why is the angle divided by 2?
  11. mathematical

    QR Algorithm & Eigen value order

    That was it, 100%! I ended up drawing out each combination of basis vectors. Visually, it becomes obvious which one's can't be rotated to. In case anyone reading this thread in the future wants to know, valid combinations are: + + + + - - - - + - + - I have one last question which is kind of unrelated (but kind of related). when doing a polar decomposition and adding the matrix to its inverse transpose, is that to be interpreted as: Q = 0.5 * (Q + Inverse(Transpose(Q))) Or as: Q = 0.5 * (Q + Transpose(Inverse(Q))) The wording on this has always confused me. Are we transposing the inverse, or taking the inverse of the transpose?
  12. mathematical

    QR Algorithm & Eigen value order

    That's a fantastic idea, but i can't find up to date contact info for him anywhere But, after reading trough the "Matrix Animation and Polar Decomposition" a few more times, i finally get what the "snuggle" function is doing. And implementing an un-optimized version of it is fairly straight forward. I have an implementation in place that mostly works right now. But there is one thing i could use some help with. The paper just takes all axis permutations of the input matrix, and checks which one has the smallest rotation (largest w component of the quaternion representing the matrix). There are supposed to be 24 permutations, i have 48.... The permutations are supposed to be: My 48 axis come from the six permutations of every axis, done each time for all axis sign combinations. (6 * 8). What i'm not getting is the "achievable by a rotation" part. Seems like that should cut the number of permutations i have in half.... Which axis / sign combinations are not achievable by a rotation? For example, if we take all permutations of the x axis being in the top row // Two permutations with x on top [ x[0], x[1], x[2], y[0], y[1], y[2], z[0], z[1], z[1] ], [ x[0], x[1], x[2], z[0], z[1], z[2], y[0], y[1], y[2] ] // 14 potential combination of negative axis [ -x[0], -x[1], -x[2], y[0], y[1], y[2], z[0], z[1], z[2] ] [ -x[0], -x[1], -x[2], -y[0], -y[1], -y[2], z[0], z[1], z[2] ], [ -x[0], -x[1], -x[2], -y[0], -y[1], -y[2], -z[0], -z[1], -z[2] ], // .... Rest of it are omitted, but there are a bunch of these! Which of those are not achievable by a rotation (and why?)
  13. mathematical

    QR Algorithm & Eigen value order

    Thanks for the cross product suggestion! I didn't consider that, but it makes a lot of sense! I'm actually implementing the affine decomposition shoemake writes about in Graphics Gems 4. All of it is working, except this last step (the SpectoralDecomposition step, i'm just using the QR Algorithm to do it), getting the right values just the "wrong" order. The full context of what i'm trying to do is this: AffineDecompositionResult AffineDecomposition(Matrix M) { FactorTranslationResult factorTranslation = FactorTranslation(M); PolarDecompResult polarDecomposition = PolarDecomposition(factorTranslation.X); FactorRotationResult factorRotation = FactorRotation(polarDecomposition.Q); SpectoralDecompositionResult spectoralDecomp = SpectoralDecomposition(polarDecomposition.S); // Everything in here are matrices AffineDecompositionResult result; result.T = factorTranslation.T; result.F = factorRotation.F; result.R = factorRotation.R; result.U = spectoralDecomp.U; result.K = spectoralDecomp.K; result.Ut = Transpose(U); return result; } I tried the second method mentioned in my last post, which was to pair each eigenvector with the basis vector whom it has the smallest angle with. It kind of works (if all elements in the eigenvector are positive). I don't feel confident in it at all, and i'm really just stabbing in the dark with that
  14. mathematical

    QR Algorithm & Eigen value order

    I'm not doing any sorting at the moment. As far as i understand, the sorting is just a natural thing that is expected to happen. Looking at the "Example (Basic QR-Method)" on page 2 & 3 of this article article, i assumed this statement to be true: And i'm just trying to undo the ordering that naturally occurs there. For context, the source for my QRDecompose function looks like this: QRDecompResult QRDecompose(Matrix A) { Vector x = (A[0], A[1], A[2]) Vector y = (A[3], A[4], A[5]) Vector z = (A[6], A[7], A[8]) // gram schmidt - Orthogonalize y = y - Projection(x, y) z = (z - Projection(x, z)) - Projection(y, z) x = Normalize(x) y = Normalize(y) z = Normalize(z) Matrix Q( x[0], x[1], x[2], y[0], y[1], y[2], z[0], z[1], z[2] ) Matrix R = Transpose(Q) * A return QRDecompResult(Q, R); } Shoemake's paper makes sense up to the "Direct Stretch Animation" part, he 100% looses me there. I'm pretty sure that section describes the "snuggle" function from here, but the code is even harder to read than the article 😛 This code won't actually run in a game, i'm not too worried about speed. I'm mostly trying to make something that's easy to read and understand. For me, this method checks both those boxes. EDIT: I'm thinking, if the eigen values are ordered in descending order, could i sort the basis vectors of the original matrix that is being decomposed by length? Would that sorting result in the same order as the eigen value order? If it does, this would be a trivial problem to solve. EDIT2: Is shoemake's paper saying that the basis vector in the original matrix each eigenvector corresponds to is the one for which the two share the smallest angle?
  15. mathematical

    QR Algorithm & Eigen value order

    The matrix that's passed in, S contains some scaling and skewing info. I'm trying to decompose it so i can figure out just the scale. I'd expect the result to (1, 15, 1), where the eigen value for 15 stays on the y axis. Looking at the resulting eigen vectors & values it's obvious that 15 belongs to the y basis: eigenvectors: [ [0, 1, 0], [-1, 0, 0], [0, 1, 0] ] eigenvalues: [15, 1, 1] But this is a. best case scenario. Doing another matrix, like: 1.59727, 0.15045, 0, 0, -1.20363, 0.19966, 0, 0, 0, 0, 0.25, 0, 0, 0, 0, 1 Will yield not so obvious results: eigenvectors: [ [0.79864, -0.60182, 0], [0.60182, 0.79864, 0], [0, 0, 1] ] eigenvalues: [2, 0.25, 0.25] I'm expecting that i have to potentially re-order both my A and Ev matrices on each iteration, i'm just not sure what the re-order logic should be. The reason i'm assuming that i'll have to re-order the matrices on each iteration is the first example, where 15 shifts to what i would consider the "wrong" spot, that starts to happen right around iteration 4.
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!