Results 1 to 4 of 4

Thread: Vector/matrix math in SDK?

  1. #1
    Newbie Member
    Join Date
    Apr 2004
    Location
    Berkeley, CA
    Posts
    99

    Vector/matrix math in SDK?

    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

    Thanks.
    --


    Ken

  2. #2
    The helper libaries provides you with the basic lwvector math.

  3. #3
    As soon as you include lwmath.h you can use a bunch of macros like VDOT, VCROSS, VADD etc. but macros are not foolproof
    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.

  4. #4
    Newbie Member
    Join Date
    Apr 2004
    Location
    Berkeley, CA
    Posts
    99
    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.

    v3=normalize(v1-v2*(v1*v2));
    would be way easier to type than
    VSUB3(v3,v1,VSCL(v2,VDOT(v1,v2)));
    VNORM(v3);
    Ugh, that's gross.


    Thanks for the reply.
    --


    Ken

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •