Recently I seem to have gotten the physics-engine portion of my 3D simulation/game engine [apparently] working correctly. The most convenient way to store and compute position and orientation are in 3-element vectors (though my code actually holds both in the x,y,z elements of a 4-element vector).

The orientation is kept in what seems to be commonly called "scaled-vector" form, where the axis is defined by the vector direction, and the rotation angle is the length of the vector (in radians).

After streamlining the code for a long time, the code is quite short and sweet (simple)... except where the code computes the new orientation (where torque forces and previous angular velocity applied to the previous orientation generate a new angular velocity and orientation). Whether this computation is done with matrices or quaternions, this section of code is relatively messy, extensive and slower to execute.

I'm not good at math (barely good enough to get the physics working after reading about ten million articles and books). But I have a very strong intuitive feeling there must be a way to rotate an orientation in scaled-vector form by a rotation also in scaled-vector form. This seems "obvious" to math-moron-me because a quaternion is equivalent to a scaled-vector, and because a quaternion is equivalent to a 4-element axis-angle vector which is itself equivalent to a scaled-vector.

Furthermore, I have found that all other computations in the physics engine with scaled-vectors are [somewhat to much] simpler and faster than any alternative, which makes me think there is something inherently good about these scaled-vectors. For one thing they don't get messed up when objects get rotating very fast (more than pi or 2pi per physics interval), while other approaches do.

Perhaps I've given more background than I should, but I do so to justify my desire to find the math to "rotate an orientation" AKA "rotate a rotation" with in scaled-vector form without converting them to quaternions or rotation matrices and back again, which is what I do now.

I've searched far and wide, but can't find the equations. I've found about ten million versions with quaternions and rotation matrices, but that's not what I'm looking for. Is my weakness in math hiding some obscure reason that this operation inherently can't be formulated with scaled-vectors?

Or can some math genius out there somewhere just whip these equations out, and receive my sincere admiration and appreciation?

PS: If someone provides these equations, I have a feeling many physics-engine and game-engine developers will find them as extremely helpful as me.

  • $\begingroup$ Did you get your math from a standard textbook on computer graphics or game design? If you did and the book is any good, it will have given you pretty much the best general purpose ways of doing these operations, already. The people who write the textbooks on those things are usually quite competent in these matters. Unless you have a special case of rotation (certain angles or combinations of angles) it's unlikely that you can do considerably better than what the standard solutions suggest. The other question is whether this is really the limiting aspect of the game engine. $\endgroup$ – CuriousOne May 19 '15 at 1:54
  • 1
    $\begingroup$ Re I've found about ten million versions with quaternions and rotation matrices, but that's not what I'm looking for. Why not? That's the way to go. Quoting from the wikipedia article en.wikipedia.org/wiki/Rotation_formalisms_in_three_dimensions, "Combining two successive rotations, each represented by an Euler axis and angle, is not straightforward ... It is best to employ the rotation matrix or quaternion notation, calculate the product, and then convert back to Euler axis and angle." $\endgroup$ – David Hammen May 19 '15 at 3:27
  • 1
    $\begingroup$ To me, it is unlikely that an answer to your question exists that isn't just converting to quaternions or rotation matrices in disguise. That said, I'm unfamiliar with scaled-vector representations (googling just leads back to this page). Could you explain a bit more about it? For example, say your object is a line from {0, 0, 0} to the point {0, 0, 1} w.r.t. object coordinates. How would you take a scaled vector and use it to determine the new endpoint of the line? $\endgroup$ – user27118 May 19 '15 at 3:54
  • 2
    $\begingroup$ The best answers you can get on this site are the usual textbook answers, as far as I can tell. That's as it should be, this is not the forum for personal theories and inventions. I still think that you should look at global optimizations. There is only so much one can cut out on the single operation level, but global optimizations (e.g. by pre-sorting vectors into classes and transforming the entire class at the same time) may get you orders of magnitude speedups if you are dealing with thousands or millions of objects. $\endgroup$ – CuriousOne May 19 '15 at 4:11
  • 1
    $\begingroup$ What you are asking doesn't belong in mathematics, either, but in computer graphics. Physics deals with the physical world, not with its efficient computation and mathematics deals with the structure of objects that satisfy certain formal criteria, whether those objects exist or not. At this point you seem to be upset about us not appreciating what "else" you are doing, even though none of this is even a physics question, to begin with. I gave you my best shot at the answer, already. That's all I can do. Good luck! $\endgroup$ – CuriousOne May 19 '15 at 4:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.