Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Code Snippets / [DBP] print matrix4 function

Author
Message
Neuro Fuzzy
17
Years of Service
User Offline
Joined: 11th Jun 2007
Location:
Posted: 30th Dec 2010 01:05 Edited at: 31st Dec 2010 06:10
To run this, you need ianm matrix utils 32, for the "set matrix" command.

prints a matrix4 and returns the width of the matrix4 in pixels. Use 0 decimal places if your matrix consists of only whole numbers.

Sven B
19
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 30th Dec 2010 13:43
In the remarks section it says:
`[2,0,2,1] [1,6,2,6]
`[1,2,3,4] [3,7,9,3]
`[2,6,1,7]x[3,5,7,1]
`[1,2,6,4] [4,3,7,3]
but it displays the transposed matrices...
(column)*4+row --> row*4+column ?

This could really help people understand the 3D math commands though.

Cheers!
Sven B

Neuro Fuzzy
17
Years of Service
User Offline
Joined: 11th Jun 2007
Location:
Posted: 30th Dec 2010 19:49 Edited at: 30th Dec 2010 20:26
:X ugh... you're right...

So in the command "set matrix" help pages, the order is 11,12,13,14,21,22,23...
Going from index 0 to 15, the "get matrix4 element" command returns
11,21,31,41,12,22,32,42...?

Ugh... these conventions are really getting me, I think one thing then it turns out to be another. maybe I won't do anything with 3d maths without making sure everything is tested first :S

I'll fix the above example.

[edit]

also, thank you a lot for pointing that out! :S

[edit2]
also also, thanks for that post in the "square pyramid" thread. It really sorted me out. Namely the property:
(x*A*B*...*N)'=x'=N'*...*B'*A'*x', showing me just how I could make such a mistake (well, a property I used correctly by mistake
).

Sven B
19
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 30th Dec 2010 20:40 Edited at: 30th Dec 2010 20:41
Quote: "So in the command "set matrix" help pages, the order is 11,12,13,14,21,22,23...
Going from index 0 to 15, the "get matrix4 element" command returns
11,21,31,41,12,22,32,42..."


The set matrix4 has the same order as 0-15.

Of course, if you insisted on using column vectors, then you're actually reading and writing the transposed matrix. This also applies to the set matrix4 command (you have to write the transposed matrix in that case).

[edit] Oh and I'm glad I could help

Sven B

Neuro Fuzzy
17
Years of Service
User Offline
Joined: 11th Jun 2007
Location:
Posted: 31st Dec 2010 06:11
ugh, you're right. Lets just say for now that I'm bad with matrices ._.

Login to post a reply

Server time is: 2024-11-21 11:42:05
Your offset time is: 2024-11-21 11:42:05