PistonDevelopers/graphics

transform_vec doesn't do what you'd expect

eira-fransham opened this issue · 3 comments

The standard behaviour for multiplying a 3x2 matrix by a 2-element vector in game/graphics programming is to one-fill the 2-element vector to a 3-element vector. This allows you to translate the vector cheaply and easily.

What graphics::math::transform_vec does, however, is zero-fill the 2-element vector. This means that any position is simply ignored. This is really unintuitive and led to a 3-hour debugging session for me (although I had other bugs in my code that were fixed along the way, so it's not all bad).

Use transform_pos.

It would probably be good to write this in the documentation for transform_vec, since at the moment the only way to discover this is via looking at the source (and understanding enough vector maths to know the problem) or via this issue.