VMath, part 1: Vectors

For my first actual content post, I thought I’d dig in to what I’ve written on the math side of things, and explain how it all works and why I chose the things I chose.  For this, and all future programming posts, the language of choice will be C++.

First thing to note, is that a lot of programmers who find themselves without a provided math library (such as is the case when working with OpenGL like me, or Vulkan) will usually end up using GLM.  There’s nothing particularly wrong with GLM, and if you aren’t especially math-inclined, then I honestly suggest you use it too.  The reason that I don’t use GLM is that, by its own admission, it’s designed for “the 90% of your code that does 10% of the work”.  That’s all fine and dandy until you start writing that other 10%, and now you need to optimize.  Without understanding how the math really works, and how your math library is doing its job, you can’t make those vital optimizations to the most important parts of the code.  Still, if you aren’t math-inclined, you can feel free to skip any VMath posts and simply use GLM as a drop-in replacement; the interface is very similar, by design.

Continue reading