Forums » Questions and answers »
Matrix class in VastPark.FrameBase.Math - row major or column major?
Added by Dennis Ong 4 months ago
Hi,
I noticed that for the Matrix2, and Matrix3 classes, you have defined them as row major, but for the Matrix class (i.e 4x4 matrix), it is defined as column major based on the Matrix class methods.
However it seems that some of the other utility methods either outputs or takes in as arguement a row major 4x4 matrix:
(a) Common.Translate(out Matrix result, ref Matrix value, float x, float y, float z)
(b) Common.Translate(out Matrix result, ref Vector3 value)
(c) Common.Translate(out Matrix result, ref Matrix value1, ref Vector3 value2)
(d) Common.Rotate(out Vector2 result, ref Vector2 value1, ref Matrix value2)
(e) Common.Rotate(out Vector3 result, ref Vector3 value1, ref Matrix value2)
(f) Common.Rotate(out Quaternion result, ref Matrix value)
and a few Common.Rotate(out Matrix result, ...) methods.
Replies (1)
RE: Matrix class in VastPark.FrameBase.Math - row major or column major?
-
Added by Alexander Tulloh 4 months ago
Hi Dennis,
Sorry about the confusion, I can imagine it may have been quite annoying tracking down the problem. I just had a look at the source; there is a bit of inconsistency, someone has fiddled with Matrix4 class and the Translate(out Matrix result, float x, float y, float z) function. There may be more but I'd have to search a bit more. I haven't been aware of this as I've only ever used Matrix4 by itself.
We definately have to address this; most likely during our next major update, as the VastPark.FrameworkBase assembly is used throughout our whole platform. However as we are quite busy with other projects, I can't promise that it will be soon.
In the meantime you could use a separate math library. Our implementation is a modified version of FastMath. You could use this, although it no longer contains 2x2 or 3x3 matrices. This is most likely what we will use internally during the next update anyway.
Sorry again, hope that helps.
(1-1/1)