Timeline for Why do these DirectXMath functions seem like they return column-major matrics?
Current License: CC BY-SA 3.0
7 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jun 16, 2020 at 10:15 | history | edited | CommunityBot |
Commonmark migration
|
|
Feb 3, 2018 at 18:43 | vote | accept | Dulan | ||
Feb 3, 2018 at 9:00 | comment | added | Chuck Walbourn | That's why the DirectXMath documentation states row vectors and premultiplication. Your 'standard notation' above is how OpenGL books write the translation matrix, and OpenGL math libraries general use column-major, column vectors. For Direct3D, you transpose it. See this blog post for a long exploration of the topic. | |
Feb 2, 2018 at 20:54 | comment | added | Dulan | So then how does that relate to a translation matrix written in standard math notation, where the translation is in the last column? | |
Feb 2, 2018 at 19:23 | comment | added | Chuck Walbourn |
XMMATRIX.r[3] contains the translation, i.e. the 4th row's x, y, and z. See Wikipedia: "In a row-major order, the consecutive elements of a row reside next to each other, whereas the same holds true for consecutive elements of a column in a column-major order.". This blog post might also help.
|
|
Feb 2, 2018 at 3:40 | comment | added | Dulan | I guess that's where my confusion is then because my understanding is that row-major storage means each row of a standard notation matrix (written in mathematical standard notation) would be contiguous in the array. So for a translation matrix, where the x, y, and z translations are in the last column of a standard notation matrix, they would each be the 4th, 8th, and 12th elements of the whole array. Am I getting mixed up between something with notation vs. the storage order here? | |
Feb 1, 2018 at 8:25 | history | answered | Chuck Walbourn | CC BY-SA 3.0 |