Is it possible to lerp between to matrices?
I know this is a fairly fundamental question, but I'm curious if it's possible to lerp between two matrices. I know you can lerp two quaternions, so if worse comes to worst I can do that.
By lerp  in case I'm using the wrong terminology, I mean:
Is there an analog for matrix math?
By lerp  in case I'm using the wrong terminology, I mean:
Code:
float lerp( float amt, float a, float b )
{
return ( amt * a ) + ( ( 1amt) * b );
}
Is there an analog for matrix math?
You can do scalar multiplication and matrix addition... so I don't se why not.
I'll have to give it a shot. I figured it would work, but I wanted to check the hive mind.
Thinking about it for a bit, it seems like things would get pretty screwy with rotation. You'll probably get some, if not a lot, of distortion while interpolating. Give it a try, though, and let us know how it goes. If it's a problem, it seems like it could be solved without too much trouble.
Just thinking about the topic, you'll run into issues. Say you have an identity matrix and a matrix that swaps y and z values. Now if you find the middle ground you end up with the following matrix...
The problem here is that both of the original matrices define a unit coordinate system. This one in the middle is not unit, so you've ended up adding a scale to the operation which I assume will be undesirable.
It's doable but you'll have to overcome some issues I think.
Code:
{{1.0 0.0 0.0 0.0}
{0.0 0.5 0.5 0.0}
{0.0 0.5 0.5 0.0}
{0.0 0.0 0.0 1.0}}
It's doable but you'll have to overcome some issues I think.
http://www.gamedev.net/community/forums/..._id=313474 has some useful information 30 second google search!
Short answer? No.
Long answer: the two matrices are orthogonal, and should remain as such during the lerp. However, rotation is a nonlinear operation and will not remain orthogonal. And, corollary to Zekaric: if you have two matrices that are just rotated 180Â° on the Z axis, how should the LERP interpret that? By rotation? Scaling? A massive shearing operation on three axes?
This is the reason that quaternions are so popular  they can be interpolated!
Long answer: the two matrices are orthogonal, and should remain as such during the lerp. However, rotation is a nonlinear operation and will not remain orthogonal. And, corollary to Zekaric: if you have two matrices that are just rotated 180Â° on the Z axis, how should the LERP interpret that? By rotation? Scaling? A massive shearing operation on three axes?
This is the reason that quaternions are so popular  they can be interpolated!
Sounds good to me. Thanks for the info, fellas.
Fenris Wrote:Short answer? No.
I challenge this. As soon as I get home, I'm going to do my darnedest to prove you wrong.
Yes, you can lerp matrices. No, it's not very helpful, for the reasons pointed out (rotations in particular don't remain rotations during a lerp).
For most applications, storing Quaternion orientation; Vector position; Scalar scale; gives you all the representative power you need, and that representation is both easy to interpolate and easy to convert to a matrix.
For most applications, storing Quaternion orientation; Vector position; Scalar scale; gives you all the representative power you need, and that representation is both easy to interpolate and easy to convert to a matrix.
I was thinking along those lines originally  I was just wondering if there were a shortcut. So it goes!
I would say 'it depends'.... If your matrices are close together, it could very well work (it's quite common when skinning). If they are more than a bit apart, it's gonna blow.
Possibly Related Threads...
Thread:  Author  Replies:  Views:  Last Post  
Angles and Matrices and Whatnot  merrill541  5  3,570 
Jun 2, 2009 04:13 AM Last Post: unknown 

Skewed Vertices with Quaternions, Matrices, and Good Ol' Trig  Oddity007  4  3,753 
May 12, 2009 03:13 PM Last Post: Oddity007 