View Full Version : Vector/matrix math in SDK?

05-31-2005, 04:32 PM
Is there a matrix builtin or any basic vector math functions available to us in the SDK? I see that lscript has cross products, dot products, normalize, and other vector math functions built in, but I can't find any such thing in the SDK. I wrote all the ones I could think of from scratch this weekend so the question is kind of moot now, but I guess I'm just wondering if all that time I spent trying to remember what exactly a cross product was was wasted or not :)


05-31-2005, 06:01 PM
The helper libaries provides you with the basic lwvector math.

06-01-2005, 08:33 AM
As soon as you include lwmath.h you can use a bunch of macros like VDOT, VCROSS, VADD etc. but macros are not foolproof :D
The vecmath SDK sample contains a global class plugin that provides functions like normalize, matrix multiplications etc. but it also states that the implementation goes for simplicity over speed.
Most of those functions are so small you should actually inline them.

And if you're using C++ you may want to write a vector-class that fits your needs and overload operators anyway, which makes handling vectors much nicer IMHO.

06-01-2005, 08:44 PM
Ah, yeah - vecmath.{c,h}, I guess that's what I was looking for. Yeah, those are #defines, so that's as inline as you can get, I guess ;)

But, yeah, overloading all the operators would be nice.

would be way easier to type than
Ugh, that's gross.

Thanks for the reply.