# Help with operations with vectors and quaternions?(solved)

Posted 7 months ago
993 Views
|
2 Replies
|
0 Total Likes
|
 I've been working with this cloud thing for a while; and implemented rotations with rotation vectors; but in evaluating the overlap between Quaternions and Rotations with rotation vectors, there are some differences; and I'm no expert in quaternions, I get the general idea...In the Quaternion section at the end, I'm trying to come up with a function that produces the same curve as the rotation function above....Q1**Q2 is like an eternal rotation; I implemented that, and got a graph that I would have expected, but the direction was reversed compared to the rotation function I implemented for rotation vectors. That's fine, I reversed the cross product in my rotation function and got it to match; however, when I took that change back to my JS library for testing this, and got quaternions and Rodrigues Rotation function rot match, then other rotation demos broke; (ie unit tests failed). Observing the behavior of this new change, it's like rotating around an external rotation instead of an internal rotation; that is instead of rotating Q1 around Q2 as if Q2 was in the frame of Q1, it's as if Q2 is in a global frame external to Q1.That's fine; Q1**Q2 can have applications, where an axis is fixed in the world, and Q1 gets rotated by it.I'd like to implement the rotation as an intrinsic rotation rather than extrinsic. (maybe it's the other way around, one demo has one behavior the other has another... but it might be that the quaternion is by default intrinsic and I need it to be extrinsic) (Q[r]**(Q[q]**-(Q[r]))); where (Q[r] = Q1, Q[q] = Q2) Is the closest... to rotate Q out of the frame of Q1, rotate Q1 by that ... but that's not right.Also - how do I use a Quaternion to rotate a point? {1,2,3}*Q[{1,1,1}] (where Q is a function that returns a the exp(axis-angle parameter)) results with a quaternion, not a point...https://www.wolframcloud.com/obj/179c18b1-d88e-46f3-bd00-3fab5e8c0db4 (It's gotten rather large with lots of additional explanation text.... but the quaternion section is just above matrices at the end... and those two sections (quats and matrices) are pretty small...
2 Replies
Sort By:
Posted 7 months ago
 https://github.com/d3x0r/STFRPhysics/blob/master/Development.md (The Long story)My rotation vector equation/function for rotating the vector was curve fitted to intrinsic rotations, that is for a frame, picking some direction within that frame, then using that axis of rotation to spin the frame relative to that; while matrix multiplication and quaternion multiplication are extrinsic multiplications, which are applied outside of the frame.I think that the overall order of operations also gets inverted; that for a multi-part ragdoll body, moving the body itself in my system updates the body, which then multiplies outward on each subsequent joint, using each composite to multiply out to the ends. I think maybe quaternions and matrices are often applied in the other direction? From the leaves of a graph to the trunk? (I think in reality there's usually changes in all joints, so caching partial results doesn't matter a lot; but in the latter case, if the limbs don't move, then they only have to be multiplied by the core again when the body updates ?
Posted 7 months ago
 for 3 quaternions q,r,s; q**r**s is one the other is s**(r**q) got it. It is just reversing those terms...