Original Post
I'm trying to write a basic math library for use in games. I'm writing support for 4D matrices and vectors because I want to be able to use a single matrix to describe both rotations and translations. But I don't know of a clean way to handle addition between two 4D matrices or two 4D vectors. For example, if I want to sum up a bunch of vectors and then transform the sum by some matrix, I'll probably want the w coordinate of the sum vector to be 1, but if I just do straight vector addition it will end up being more than 1. I could just ignore the fourth dimension when performing addition, but this seems like an ugly hack. This seems like it would be a fairly common problem, so I'm just wondering if there is some sort of convention on how to perform addition.