Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members

Vector3.h

00001 
00002 #ifndef __VECTOR3_H_
00003 #define __VECTOR3_H_
00004 /*
00005 Peon - Win32 Games Programming Library
00006 Copyright (C) 2002-2005 Erik Yuzwa
00007 
00008 This library is free software; you can redistribute it and/or
00009 modify it under the terms of the GNU Library General Public
00010 License as published by the Free Software Foundation; either
00011 version 2 of the License, or (at your option) any later version.
00012 
00013 This library is distributed in the hope that it will be useful,
00014 but WITHOUT ANY WARRANTY; without even the implied warranty of
00015 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00016 Library General Public License for more details.
00017 
00018 You should have received a copy of the GNU Library General Public
00019 License along with this library; if not, write to the Free
00020 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00021 
00022 Erik Yuzwa
00023 peon AT wazooinc DOT com
00024 */
00025 
00026 #include "Peonstdafx.h"
00027 
00028 namespace peon 
00029 {
00030 
00037         class PEONMAIN_API Vector3
00038         {
00039         public:
00040 
00042                 float x;
00043 
00045                 float y;
00046 
00048                 float z;
00049 
00050   
00051                 Vector3(float x_ = 0.0f, float y_ = 0.0f, float z_ = 0.0f);
00052                 ~Vector3();
00053 
00054                 void set(float x_, float y_, float z_);
00055                 float length(void);
00056                 void normalize(void);
00057 
00058                 // Static utility methods
00059                 static float distance(const Vector3 &v1, const Vector3 &v2);
00060                 static float dotProduct(const Vector3 &v1,  const Vector3 &v2 );
00061                 static Vector3 crossProduct(const Vector3 &v1, const Vector3 &v2);
00062 
00063                 // Operators...
00064                 Vector3 operator + (const Vector3 &other);
00065                 Vector3 operator - (const Vector3 &other);
00066                 Vector3 operator * (const Vector3 &other);
00067                 Vector3 operator / (const Vector3 &other);
00068 
00069                 Vector3 operator * (const float scalar);
00070                 friend Vector3 operator * (const float scalar, const Vector3 &other);
00071     
00072                 Vector3& operator = (const Vector3 &other);
00073                 Vector3& operator += (const Vector3 &other);
00074                 Vector3& operator -= (const Vector3 &other);
00075 
00076                 Vector3 operator + (void) const;
00077                 Vector3 operator - (void) const;
00078         };
00079 
00080 
00081 
00082 }
00083 
00084 #endif
00085 

Generated on Thu Dec 1 01:55:40 2005 for Peon by  doxygen 1.4.1