Thread: determinants

  1. #1
    Registered User linuxdude's Avatar
    Join Date
    Mar 2003
    Location
    Louisiana
    Posts
    926

    determinants

    I know of matricies in OpenGL and in my math class we just went over determinants. Are they of any importance in game programming?

  2. #2
    Registered User Draco's Avatar
    Join Date
    Apr 2002
    Posts
    463
    determinants have a huge importance in game programming. Doing a vector cross product (which uses determinats) will get you the normal vector to a point/surface, etc. Just one example of this being used is most lighting algorithms. Other parts of graphics such as camera/screen orientation use them extensively as well, which is why it's programmed into OpenGL and DirectX.

  3. #3
    Registered User
    Join Date
    Mar 2003
    Posts
    580
    How does doing a vector cross product use determinants? Maybe there's something in the theory I've missed, but I thought a determinant is basically just a number which you must compute along the process of calculating the inverse of a matrix.

    The determinant of a 3x3 matrix is calculated and returned by this function:

    inline float det3x3(float a1, float a2, float a3,
    float b1, float b2, float b3,
    float c1, float c2, float c3)
    {
    return a1*b2*c3+a2*b3*c1+a3*b1*c2-a3*b2*c1-a1*b3*c2-a2*b1*c3;
    }
    I'm pretty sure that once you have that number, you just divide each element by the determinant, after you've check that the determinant isn't zero (if it's zero, I think that means it's already its own inverse or something like that).
    Last edited by Darkness; 11-18-2004 at 06:28 PM.
    See you in 13

  4. #4
    Registered User
    Join Date
    Apr 2002
    Posts
    1,571
    "...the results are undefined, and we all know what "undefined" means: it means it works during development, it works during testing, and it blows up in your most important customers' faces." --Scott Meyers

  5. #5
    Registered User
    Join Date
    Mar 2003
    Posts
    580
    That's cool, I guess I never really examined any formal proofs of cross product, which is why I didn't know where the determinant came into play.
    See you in 13

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Trying to make this code faster & Cramer
    By just2peachy in forum C++ Programming
    Replies: 3
    Last Post: 12-03-2004, 10:54 AM
  2. cramer's rule (which uses determinants)
    By alvarorahul in forum C Programming
    Replies: 2
    Last Post: 07-16-2004, 01:49 PM
  3. determinants
    By Unregistered in forum C++ Programming
    Replies: 3
    Last Post: 04-07-2002, 12:40 PM