GLM: How to transpose a vector?

Maybe I just missed something in the docs, but it seems that transposing a vector cannot be done with GLM. I also do not see the types mat3x1 or mat1x3. Also glm :: transpose does not work for vectors. Am I missing something or is it just a function that does not have GLM?

+7
source share
2 answers

GLM is based on GLSL, where there is simply no need to transpose a vector. If you are doing vector / matrix multiplication, it will multiply the vector the way it works for matrix size (unless that changes the order of multiplication). Therefore, if you have mat4 and do mat4*vec4 , your vec4 is considered a column vector. If you do vec4*mat4 , this is considered a row vector. If you execute mat2x4*vec4 , you get an error, and vec4*mat2x4 works (like a line vector).

So, in general, there is no reason to β€œtranspose” a vector. The system just does everything that works.

+8
source

As a reference for people who are looking for how to transpose a vector (mainly for calculating external products - uv T ) in GLSL / GLM; his:

 glm::core::function::matrix::outerProduct(u, v) 

The Nicol GLM link is now 404s, as their API links have changed the format:

+3
source

All Articles