00001 ////////////////////////////////////////////////////////////////////// 00002 // Copyright (c) 2001-2003 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_geom_gePoint_inline_h 00020 #define freecloth_geom_gePoint_inline_h 00021 00022 #include <freecloth/base/baMath.h> 00023 00024 FREECLOTH_NAMESPACE_START 00025 00026 //////////////////////////////////////////////////////////////////////////////// 00027 // CLASS GePoint 00028 00029 //------------------------------------------------------------------------------ 00030 00031 inline GePoint::GePoint() 00032 {} 00033 00034 //------------------------------------------------------------------------------ 00035 00036 inline GePoint::GePoint( Float x, Float y, Float z) 00037 : _x( x ), _y( y ), _z( z ) 00038 {} 00039 00040 //------------------------------------------------------------------------------ 00041 00042 inline bool GePoint::operator==( const GePoint& rhs ) const 00043 { 00044 return 00045 BaMath::isEqual( _x, rhs._x ) && 00046 BaMath::isEqual( _y, rhs._y ) && 00047 BaMath::isEqual( _z, rhs._z ); 00048 } 00049 00050 //------------------------------------------------------------------------------ 00051 00052 inline bool GePoint::operator!=( const GePoint& rhs ) const 00053 { 00054 return !operator==( rhs ); 00055 } 00056 00057 00058 //------------------------------------------------------------------------------ 00059 00060 inline Float GePoint::operator[]( UInt32 i ) const 00061 { 00062 DGFX_ASSERT( i < 3 ); 00063 switch( i ) { 00064 case 0: return _x; 00065 case 1: return _y; 00066 case 2: return _z; 00067 } 00068 return 0; 00069 } 00070 00071 //------------------------------------------------------------------------------ 00072 00073 inline Float& GePoint::operator[]( UInt32 i ) 00074 { 00075 DGFX_ASSERT( i < 3 ); 00076 switch( i ) { 00077 case 0: return _x; 00078 case 1: return _y; 00079 case 2: return _z; 00080 } 00081 // Failure. 00082 return _x; 00083 } 00084 00085 00086 //////////////////////////////////////////////////////////////////////////////// 00087 // GLOBAL FUNCTIONS 00088 // 00089 00090 FREECLOTH_NAMESPACE_END 00091 00092 #endif