C:/Users/Mike/Documents/Visual Studio Projects/GameEngine/include/Vector3.h

Go to the documentation of this file.
00001 /*
00002 -----------------------------------------------------------------------------
00003 Copyright (C) 2006 Michael Harnetty
00004 
00005 This program is free software; you can redistribute it and/or
00006 modify it under the terms of the GNU General Public License
00007 as published by the Free Software Foundation; either version 2
00008 of the License, or (at your option) any later 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 General Public License for more details.
00014 
00015 You should have received a copy of the GNU General Public License
00016 along with this program; if not, write to the Free Software
00017 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
00018 -----------------------------------------------------------------------------
00019 */
00020 
00021 #ifndef VECTOR_3_H
00022 #define VECTOR_3_H
00023 
00024 #include "GameEnginePrerequisites.h"
00025 
00026 namespace GameEngine {
00027 
00030         class ENGINE_DECL Vector3
00031         {
00032         public:
00035                 Vector3();
00036 
00041                 Vector3(const Vector3& v);
00042 
00049                 Vector3(Real x, Real y, Real z);
00050 
00051                 ~Vector3();
00052 
00053 
00054                 // Geometric functions
00057                 Real length() const;
00058 
00061                 Real dot(const Vector3& v) const;
00062 
00065                 Vector3 cross(const Vector3& v) const;
00066 
00069                 Vector3& normalise();
00070 
00071 
00072                 // Algebraic functions
00073                 Vector3 operator+ (const Vector3& v) const;
00074                 Vector3 operator- (const Vector3& v) const;
00075                 Vector3 operator* (const Real scalar) const;
00076                 Vector3& operator *=(Real scalar);
00077 
00078 
00079                 // Comparison functions
00080 
00081 
00082                 // Conversion functions to and from other libraries vectors
00085                 operator Ogre::Vector3() const { return Ogre::Vector3(mX, mY, mZ); }
00088                 operator opal::Vec3r() const { return opal::Vec3r(mX, mY, mZ); }
00091                 operator opal::Point3r() const { return opal::Point3r(mX, mY, mZ); }
00092 
00093 
00096                 static Vector3 vecFromOgre(Ogre::Vector3 v) { return Vector3(v.x, v.y, v.z); }
00097 
00100                 static Vector3 vecFromOpal(opal::Vec3r v) { return Vector3(v.x, v.y, v.z); }
00101 
00104                 static Vector3 vecFromOpal(opal::Point3r v) { return Vector3(v.x, v.y, v.z); }
00105 
00106 
00107                 Real mX, mY, mZ;
00108 
00109                 // Special vectors
00110                 static const Vector3 ZERO;
00111                 static const Vector3 UNIT_X;
00112                 static const Vector3 UNIT_Y;
00113                 static const Vector3 UNIT_Z;
00114 
00115         };
00116 
00117 }
00118 
00119 #endif

Generated on Thu Apr 19 09:47:02 2007 for GameEngine by  doxygen 1.5.2