K3dMath.cpp

Go to the documentation of this file.
00001 
00009 /***************************************************************************
00010  *   Copyright (C) 2007 by Jan Koci   *
00011  *   honza.koci@email.cz   *
00012  *   http://kengine.sourceforge.net/tutorial/
00013  *                                                                         *
00014  *   This program is free software; you can redistribute it and/or modify  *
00015  *   it under the terms of the GNU General Public License as published by  *
00016  *   the Free Software Foundation; either version 2 of the License, or     *
00017  *   (at your option) any later version.                                   *
00018  *                                                                         *
00019  *   This program is distributed in the hope that it will be useful,       *
00020  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00021  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00022  *   GNU General Public License for more details.                          *
00023  *                                                                         *
00024  *   You should have received a copy of the GNU General Public License     *
00025  *   along with this program; if not, write to the                         *
00026  *   Free Software Foundation, Inc.,                                       *
00027  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
00028  ***************************************************************************/
00029 
00030 
00031 #include "K3dMath.h"
00032 
00033 K3dMath::K3dMath()
00034 {
00035 
00036 }
00037 K3dMath::~K3dMath()
00038 {
00039 
00040 }
00041 
00047 bool K3dMath::EqualRange ( const float _f0, const float _f1, const float _fRange )
00048 {
00049         float fDiff = _f1 - _f0;
00050         // Set positive difference
00051         if ( fDiff < 0 )
00052         {
00053                 fDiff = -fDiff;
00054         }
00055         // If differce is on the range return true
00056         if ( fDiff <= _fRange )
00057         {
00058                 return true;
00059         }
00060         return false;
00061 }
00062 
00063 //----------------------------------------------------------------------------
00064 // explicit instantiation
00065 //----------------------------------------------------------------------------
00066 
00067 const float K3dMath::EPSILON = 1.192092896e-07F;
00068 const float K3dMath::MAX_REAL = 3.402823466e+38F;
00069 const float K3dMath::K_PI = ( float ) 3.1415926535897932384626433832795;/*(float)4.0*atanf((float)1.0);//*///
00070 const float K3dMath::TWO_PI = ( float ) 6.283185307179586476925286766559;//2.0f*K3dMath::PI;
00071 const float K3dMath::HALF_PI = ( float ) 1.5707963267948966192313216916398;//0.5f*K3dMath::PI;
00072 const float K3dMath::QUARTER_PI = ( float ) 0.78539816339744830961566084581988;//0.25f*K3dMath::PI;
00073 const float K3dMath::THREE_HALF_PI = ( float ) 4.7123889803846898576939650749193;//K3dMath::PI + K3dMath::HALF_PI;
00074 const float K3dMath::INV_PI = ( float ) 0.31830988618379067153776752674503;//1.0f/K3dMath::PI;
00075 const float K3dMath::INV_TWO_PI = ( float ) 0.15915494309189533576888376337251;//1.0f/K3dMath::TWO_PI;
00076 const float K3dMath::K_DEG_TO_RAD = ( float ) 0.017453292519943295769236907684886;//K3dMath::PI/180.0f;
00077 const float K3dMath::K_RAD_TO_DEG = ( float ) 57.295779513082320876798154814105;//180.0f/K3dMath::PI;
00078 const float K3dMath::K_FI= ( float ) 1.618033988749894903;      

Generated on Thu Aug 16 23:53:27 2007 for K3dEngine by  doxygen 1.5.0