Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members

vhdVector3.h

00001 00002 // Copyright : Sebastien Schertenleib 00003 // : VRLab-EPFL 00004 // 00005 // Email :Sebastien.Schertenleib@epfl.ch 00006 // 00007 // This source code is a part of the Game Programming Gems 5 Source Code 00008 // 00009 // Permission to copy, modify, reproduce or redistribute this source code is 00010 // granted provided the above copyright notice is retained in the resulting 00011 // source code. 00012 // 00013 // This file is provided 'as is' with no expressed or implied warranty. 00014 // The author accepts no liability if it causes any damage to your computer. 00015 // 00016 // Do expect bugs. 00017 // Please let me know of any bugs/mods/improvements. 00018 // and I will try to fix/incorporate them into this file. 00019 // Enjoy! 00020 // 00022 00023 #ifndef VHDVECTOR3_H 00024 #define VHDVECTOR3_H 00025 00026 //remove warning conversion from double or float to vhtReal 00027 #pragma warning(disable:4244) 00028 00029 00030 #include <ostream> 00031 #define vhtReal float 00032 00042 class vhdVector3 00043 { 00044 00045 public: 00046 // coordinates 00047 vhtReal x, y, z; 00048 00049 public: 00050 vhdVector3(); 00051 vhdVector3( vhtReal fX, vhtReal fY, vhtReal fZ ); 00052 vhdVector3( const vhdVector3& rkVector ); 00053 00054 //vhtReal operator [] ( unsigned int index ) const; 00055 vhtReal& operator [] ( int index ) const; 00056 00061 vhdVector3& operator = ( const vhdVector3& rkVector ); 00062 bool operator == ( const vhdVector3& rkVector ) const; 00063 bool operator != ( const vhdVector3& rkVector ) const; 00064 00065 00066 // arithmetic operations 00067 vhdVector3 operator + ( const vhdVector3& rkVector ) const; 00068 vhdVector3 operator - ( const vhdVector3& rkVector ) const; 00069 vhdVector3 operator * ( vhtReal fScalar ) const; 00070 vhdVector3 operator * ( const vhdVector3& rhs) const; 00071 vhdVector3 operator / ( vhtReal fScalar ) const; 00072 vhdVector3 operator - () const; 00073 00075 friend vhdVector3 operator * ( vhtReal fScalar, const vhdVector3& rkVector ); 00076 00077 // arithmetic updates 00078 vhdVector3& operator += ( const vhdVector3& rkVector ); 00079 vhdVector3& operator -= ( const vhdVector3& rkVector ); 00080 vhdVector3& operator *= ( vhtReal fScalar ); 00081 vhdVector3& operator /= ( vhtReal fScalar ); 00082 vhdVector3& operator *= ( const vhdVector3& rkVector ); 00083 vhdVector3& operator /= (const vhdVector3& rkVector); 00084 00085 00086 00089 friend std::ostream& operator << 00090 ( std::ostream& o, const vhdVector3& v ) 00091 { 00092 o << "vhdVector3(" << v.x << ", " << v.y << ", " << v.z << ")"; 00093 return o; 00094 } 00095 00096 00097 00098 }; 00099 00100 00101 00102 #include "vhdVector3.inl" 00103 00104 00105 #endif //VHDVECTOR3_H

Generated on Sun Oct 3 16:32:22 2004 for vhdABTTree by doxygen 1.3.8