Re: C style math libraries versus "proper" C++ maths

"Richard Fabian" <[email protected]> Sun, 26 Mar 2006 13:15:57 +0100
Newsgroups gmane.games.devel.general
Message-ID <[email protected]>
Thanks for the help, the C++ library is now marginally faster than the C
library, and now i can approve it for general use at our company. I'm gonna
love being able to change my code from:

    Vector relativeStart, lineDirection;
    VectorSubtract( &relativeStart, pos, lineStart );
    VectorSubtract( &lineDirection, lineEnd, lineStart );
    F32 lineLength = VectorLength( lineDirection );
    VectorMultiply( &lineDirection, 1.0f / lineLength );


to:

    Vec3 relativeStart( pos - lineStart ), lineDirection( lineEnd -
lineStart );
    F32 lineLength = lineDirection.GetLength();
    lineDirection /= lineLength;


thanks again guys