00001 //////////////////////////////////////////////////////////////////////
00002 // Copyright (c) 2001-2002 David Pritchard <drpritch@alumni.uwaterloo.ca>
00003 //
00004 // This program is free software; you can redistribute it and/or
00005 // modify it under the terms of the GNU Lesser General Public License
00006 // as published by the Free Software Foundation; either
00007 // version 2 of the License, or (at your option) any later
00008 // version.
00009 //
00010 // This program is distributed in the hope that it will be useful,
00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00013 // GNU Lesser General Public License for more details.
00014 //
00015 // You should have received a copy of the GNU Lesser General Public License
00016 // along with this program; if not, write to the Free Software
00017 // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00018
00019 #ifndef freecloth_base_baMath_inline_h
00020 #define freecloth_base_baMath_inline_h
00021
00022 FREECLOTH_NAMESPACE_START
00023
00024 //------------------------------------------------------------------------------
00025
00026 inline Float BaMath::ceil( Float x )
00027 {
00028 return static_cast<Float>( ::ceil(x) );
00029 }
00030
00031 //------------------------------------------------------------------------------
00032
00033 inline Float BaMath::floor( Float x )
00034 {
00035 return static_cast<Float>( ::floor(x) );
00036 }
00037
00038 //------------------------------------------------------------------------------
00039
00040 inline Float BaMath::round( Float x )
00041 {
00042 return floor( x + 0.5f );
00043 }
00044
00045 //------------------------------------------------------------------------------
00046
00047 inline bool BaMath::isInteger( Float x )
00048 {
00049 return round( x ) == x;
00050 }
00051
00052 //------------------------------------------------------------------------------
00053
00054 inline Float BaMath::sqr( Float x )
00055 {
00056 return x * x;
00057 }
00058
00059 //------------------------------------------------------------------------------
00060
00061 inline Float BaMath::sqrt( Float x )
00062 {
00063 return static_cast<Float>( ::sqrt( x ) );
00064 }
00065
00066 //------------------------------------------------------------------------------
00067
00068 inline Float BaMath::cos( Float x )
00069 {
00070 return static_cast<Float>( ::cos( x ) );
00071 }
00072
00073 //------------------------------------------------------------------------------
00074
00075 inline Float BaMath::sin( Float x )
00076 {
00077 return static_cast<Float>( ::sin( x ) );
00078 }
00079
00080 //------------------------------------------------------------------------------
00081
00082 inline Float BaMath::tan( Float x )
00083 {
00084 return static_cast<Float>( ::tan( x ) );
00085 }
00086
00087 //------------------------------------------------------------------------------
00088
00089 inline Float BaMath::arccos( Float x )
00090 {
00091 return static_cast<Float>( ::acos( x ) );
00092 }
00093
00094 //------------------------------------------------------------------------------
00095
00096 inline Float BaMath::arcsin( Float x )
00097 {
00098 return static_cast<Float>( ::asin( x ) );
00099 }
00100
00101 //------------------------------------------------------------------------------
00102
00103 inline Float BaMath::arctan( Float x )
00104 {
00105 return static_cast<Float>( ::atan( x ) );
00106 }
00107
00108 //------------------------------------------------------------------------------
00109
00110 inline Float BaMath::arctan2( Float y, Float x )
00111 {
00112 return static_cast<Float>( ::atan2( y, x ) );
00113 }
00114
00115 //------------------------------------------------------------------------------
00116
00117 inline Float BaMath::exp( Float x )
00118 {
00119 return static_cast<Float>( ::exp( x ) );
00120 }
00121
00122 //------------------------------------------------------------------------------
00123
00124 inline Float BaMath::log( Float x )
00125 {
00126 return static_cast<Float>( ::log( x ) );
00127 }
00128
00129 FREECLOTH_NAMESPACE_END
00130
00131 #endif
1.2.14 written by Dimitri van Heesch,
© 1997-2002