Matrix inverse.

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 23/05/2005 at 12:05, xxxxxxxx wrote:
User Information:
Cinema 4D Version: 9.1
Platform: Windows ;
Language(s) : C++ ;
Hi,I am trying to get the inverse of a bone transformation, when i use !m (where m = bone>GetMl()) I get incorrect values. since multiplying the result with the original matrix (the one that the inverse was obtained for) doesn't return a unit matrix ... in short, I found that multiplying a matrix by its inverse doesn't return a unit matrix. so this means that the inverse of a matrix SDK code has a bug in it ... any ideas ?

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 23/05/2005 at 12:17, xxxxxxxx wrote:
does this only happen with the local matrix? I cannot check currently, but I am sure that it´s working without problems with the global matrix. And as these objects are surely calculated by the same class function (at least I assume they are), it´s kind of hard to assume it´s buggy.
Are you sure you haven´t unintentionally overwritten the original matrix (or the inverse)?
Furthermore, are you sure your axis system is not distorted in any way (e.g. due to lots of matrix readings/writings, which results in innacurracies). Make also sure you always use the "force" option as FALSE when you use SetMl() or SetMg().
Hmm, cannot think of anything else right now. However, curious to know this now, too. :)

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 23/05/2005 at 12:42, xxxxxxxx wrote:
Hi,
I get the same result if i modify my equations to use the global matrix instead. I belive that there are distortions due to reading a lot of matrices and then finding the inverse of the product. what i actually do is, get the global transform based on concatenation of the local transforms in the heirarchy and then i get the inverse to caculate the matrix offset. And getting that inverse seems to be problematic since when i multiply it by the original matrix from which the inverse was derived (for checking purposes) i don't get the unit matrix, which indicates an error in the inverse process. Also, when i look at the elements of the matrix, a lot of them are in order of 10^(10) which indicates distortion.

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 23/05/2005 at 12:54, xxxxxxxx wrote:
There is certainly no bug in the SDK function otherwise the whole of CINEMA would be falling apart ;) are you sure this isn't just floating point rounding errors? they are fairly normal and you must deal with your calculations carefully to keep them as small as possible. Are you using Matrix or LMatrix? 32 bit floats are not that accurate.

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 23/05/2005 at 18:53, xxxxxxxx wrote:
I am using Matrix since it is the type returned by GetMl();

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 23/05/2005 at 20:18, xxxxxxxx wrote:
I must chime in here with selwakad. I gave up using C4D quaternions because no one could explain how to convert LVectors,LMatrices to Vectors,Matrices and vice versa (8.503 SDK and above). One would take it that the only way would be to convert the base elements (Real<>LReal) from one to the other since no other conversion methodology is provided.
My point is this. What use is the extra precision, except maybe during long calculations where it may be lost, if you must give it up to use in the 'real' world  with objects and transforms and so on that only accept Vector and Matrix (and never LVector and LMatrix instead!!)?
Thank ye all,

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 24/05/2005 at 11:13, xxxxxxxx wrote:
You should rarely need to use the extra precision other than in your own calculations, it would not make much sense to pass extra precision into a function which would then not use it anyway and to duplicate all functions just to add support for extra procession would be considerable work with little gain.
I'm not sure what the rant is aimed at? What function/s are you having issues with?
I've rarely needed to use anything more than Matrix and Real other than within my own calcs and usually not that often, you really don't want the extra overhead of 64bit if you can avoid it.

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 24/05/2005 at 11:24, xxxxxxxx wrote:
That was the thing. C4D Quaternions use LMatrix and LVector. To feed the results into the Mg, Ml or any other object matrix transform, you need to convert these into Matrix and Vector (you cannot compile using LMatrixLVector and MatrixVector interchangeably and it's not a good idea to cast these). Even Quaternion has Vector and Matrix for SetMatrix and SetAxis, but returns LMatrix for GetMatrix.
This means that you must juggle two sets of matrix and vector (L and nonL) to do calculations using C4D Quaternions. It also means, without L <>nonL conversion functions, you must do the long matrix/vector element conversions (from LReal<>Real) at each crossover. This increases memory usage and decreases performance (albeit slightly).
There is no way to use C4D Quaternions and not use LMatrix/LVector  in R8.503 and above.