
created. The other advantage is that the resulting assembly code is just as fast as if the functions had all been explicitly written.
even if that assembly is optimised sse?
vector2d v1(1.0f, 2.0f); vector3d v2(-1.0f, 3.0f, 2.0f); vector4d res;
vector_add(v1, v2, res); /* res now contains (0.0f, 5.0f, 2.0f, 1.0f) */
I've been bitten too many times using a library that does just this, if I want to change a n dimensional vector to any other dimension the added values should be explicitly provided. Optimised versions that implicitly assume a value should be named accordingly so their use is obvious. Also using a c style interface to make the actual maths even more impenetrable seems like a bad idea. There was a very long discussion about a vector library aimed towards game development on the sweng mailing list recently (http://lists.midnightryder.com/pipermail/sweng-gamedev-midnightryder.com/) which you may find useful. cheers Martin