cpml.mat4.to_vec4s() and cpml.mat4.to_vec4s_cols() are reversed
leonardus opened this issue · comments
CPML documentation states that cpml matrices are column-major.
local testmatrix = cpml.mat4.new{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}
This should be the matrix:
[1 5 9 13]
[2 6 10 14]
[3 7 11 15]
[4 8 12 16]
If so, this prints the opposite results from what is expected:
for _, row in pairs(cpml.mat4.to_vec4s(testmatrix)) do
print("row: ", row[1], row[2], row[3], row[4])
end
for _, col in pairs(cpml.mat4.to_vec4s_cols(testmatrix)) do
print("col: ", col[1], col[2], col[3], col[4])
end
row: 1 2 3 4
row: 5 6 7 8
row: 9 10 11 12
row: 13 14 15 16
col: 1 5 9 13
col: 2 6 10 14
col: 3 7 11 15
col: 4 8 12 16
yeah, definite bad naming, it's a side effect of these functions being
thrown in to address an old version of LOVE taking sideways matrices in,
which made things really confusing.
…On Thu, Jan 12, 2023 at 2:22 PM leonardus ***@***.***> wrote:
CPML documentation states that cpml matrices are column-major.
local testmatrix = cpml.mat4.new{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}
This should be the matrix:
[1 5 9 13]
[2 6 10 14]
[3 7 11 15]
[4 8 12 16]
If so, this prints the opposite results from what is expected:
for _, row in pairs(cpml.mat4.to_vec4s(testmatrix)) do
print("row: ", row[1], row[2], row[3], row[4])endfor _, col in pairs(cpml.mat4.to_vec4s_cols(testmatrix)) do
print("col: ", col[1], col[2], col[3], col[4])end
row: 1 2 3 4
row: 5 6 7 8
row: 9 10 11 12
row: 13 14 15 16
col: 1 5 9 13
col: 2 6 10 14
col: 3 7 11 15
col: 4 8 12 16
—
Reply to this email directly, view it on GitHub
<#84>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AABVS5W6HKD5AYGBWH5ZVTDWSB73XANCNFSM6AAAAAATZYCBYA>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>