Matrices in Codea - a blog(ish) post

I’ve written a blog(ish) post about matrices in Codea. Having seen a fair amount of confusion about them, I thought I’d like to set things straight. There are a few subtleties about order and so forth.

You can read it at Although the website uses a forum software, it’s not a forum. I suggest comments and discussions be here.

This was being written while certain recent conversations here about matrices were happening. These inspired various parts.

I read this article. It’s really good! It gets a bit heady in the middle, so read, take a short break, then go back to it! Great article, Andrew!


Which bits are “heady”? I tried to keep the maths to a minimum but it’s a bit tricky to do.

Thanks for writing this, @Andrew_Stacey! I will need to play with the examples to better understand it. I’ve used quaternions before for 3D rotations, but couldn’t say I understand them fully. Are they applicable to Codea for specifying rotations?

@Fred I use quaternions for handling rotations - I find them much easier to handle and manipulate than rotation matrices. When writing my shape explorer, I wrote a library for dealing with quaternions: In particular, it has a function for converting a quaternion to a matrix suitable for using in modelMatrix().

I could write a follow-up post on quaternions if there’s interest.

Please do, quarternions are of interest as they seem ‘simpler’ to deal with.

Yes @Andrew_Stacey, I enjoy reading your explanations and would be interested in reading about what you’ve done with quaternions for Codea.

The sub article ‘saving the result’ starts to go beyond easy explanation. By the time someone gets there, their head is buzzing and they should take a break before trying to read all that math…

My intention was that you don’t have to read the more maths-y bits - you can just assume the result. I just don’t like it when something says “This is what you need to do” without giving any explanation. If it provides explanation then I can choose to skip it or not, but if it doesn’t then I don’t have a choice.

So…how is that quarternions article going? I am working on artillery fire, seems that quats would be good for that!