/* =========================================================================== maya2q3 - export .md3 files from maya Copyright (C) 2007 HermitWorks Entertainment Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. =========================================================================== */ #ifndef INC__math_h_ #define INC__math_h_ #ifdef min #undef min #endif #ifdef max #undef max #endif template< typename T > inline T min( const T &a, const T &b ) { return (a < b) ? a : b; } template< typename T > inline T max( const T &a, const T &b ) { return (b < a) ? a : b; } template< typename T > inline T clamp( const T &val, const T &min, const T &max ) { if( val < min ) return min; if( max < val ) return max; return val; } template< typename T > inline T saturate( const T &val ) { if( val < 0 ) return 0; if( 1 < val ) return 1; return val; } template< typename T > inline int sign( const T &val ) { if( val < 0 ) return -1; if( 0 < val ) return 1; return 0; } void CalculateEigensystem3x3s( //in, the matrix float m11, float m21, float m22, float m31, float m32, float m33, //out, the eigenvectors (must be float[3]) float *er, float *es, float *et, //out, the eigenvalues corresponding to r, s, t (must be float[3]) float *el ); #endif