Left handed, right handed, up vector, column vector, row vector, column major, row major, what?

Each 3D package has it’s own conventions of how to span the 3D space, how to perform matrix*vector multiplications and how to store matrices in memory. The above examples use the conventions of Unity3D, which is a Left Handed coordinate system in which Y is thought to point “upwards”, vectors are thought of as being column vectors and matrices are stored in column major order in memory. XNA for example uses a Right Handed coordinate system in which Y points “upwards”, vectors are thought of as being row vectors and matrices are stored in row major order. Note that this is purely a notational convention. If you will look at the implementation of a matrix*vector multiplication of a system using column vectors and column major matrices and compare this to the implementation of a corresponding function in a system using row vectors and row major matrices, you will find exactly the same math and memory access patterns, but the way you think about it is different (and it is nevertheless important to understand the conventions to get your math right). So, I http://scadss.com/fitg/mobile-phone-keylogger/ myConair it.

what does that mean in theory?

Left handed vs. right handed

the Orientation of the system describes how the three basis vectors that span the vector space are laid out against each other. X is always the thumb, Y the index finger and Z the middle finger. The Orientation of the system tells you which hand to use to visualize the space. It also tells you which hand to use when visualizing a cross product (thumb x index finger = middle finger), or when visualizing the axis-angle representation of a rotation (it rotates around your thumb in the direction of your other fingers).

Column vectors vs. row vectors

In computer memory, a vector is just a bunch of floating point values, usually laid out sequentially. The implementation of a vector usually has no notion about whether it represents a column or a row vector. But the way a vector is thought of (as being either row or column vector) affects how certain operations are implemented and therefore this is part of the conventions a 3D system uses. If we think of vectors as being row vectors, it means that they must be multiplied from the left with a matrix when transforming them. A column vector would need to be multiplied from the right. This affects the order in which the elements of the matrix are multiplied/added with the elements of the vector and therefore affects the result (Note: multiplying a row vector from the left to a matrix yields the same result as multiplying a column vector from the right to the transpose of that matrix). It also affects the order in which matrix*matrix multiplications must be performed. For example: When scaling, rotating and translating a model in 3D space, usually the vertices must be scaled first, then rotated and then translated in order to achieve the desired result. This operation can be described in a single affine transformation matrix that can be computed by multiplying a scale matrix, a rotation matrix and a translation matrix. if vectors are thought of as being row vectors and therefore are multiplied from the left, the transformation matrix must be calculated as A = S*R*T do get the desired result. In the case of column vectors that are multiplied from the right, the transformation matrix is calculated as A = T*R*S.

Column major vs. row major

Similarily to vectors, a matrix implementation also does not have a notion of being row major or column major. It usually consists of 16 floating point values that are laid out sequentially in memory. Whether it is is said to be column major or row major is a purely notational convention that tells us how to write down the 16 floating point values onto a sheet of paper if we want to visualize the matrix in order to think about which elements to access when implementing a certain operation that shall correspond to the convention used. In this sense, for a matrix containing ascending integers in the 16 sequentially laid out values this would mean: column major row major matrix

Now, what does all of this mean in practice?

In practice this usually means the following: If you think your math is right but don’t see anything meaningful on screen, transpose your matrices and/or reverse the order of your matrix*matrix multiplications until stuff looks right. If you found this article helpful, have any questions or corrections, please let us know in the comments.


Leave a Comment