www.pudn.com > Particles_OGL.zip > vector.h
#ifndef VECTOR_H #define VECTOR_H #includeclass CVector { public: // Constructors CVector() : x(0.0f), y(0.0f), z(0.0f) {} CVector(float xxx, float yyy, float zzz) : x(xxx), y(yyy), z(zzz) {} // Copy Constructor CVector(const CVector &vec) : x(vec.x), y(vec.y), z(vec.z) {} // Overloaded Operators CVector& operator =(const CVector &vec); CVector operator +(const CVector &vec) const; CVector operator -(const CVector &vec) const; CVector operator -() const; void operator +=(const CVector &vec); void operator -=(const CVector &vec); bool operator ==(const CVector &vec) const; bool operator !=(const CVector &vec) const; // '*' will perform the dot product operation // between two vectors float operator *(const CVector &vec) const; // Sets the CVector to the passed in values void set(float xxx, float yyy, float zzz); void set(const CVector &vec); void negate(); // Negates the CVector void normalize(); // Normalizes the CVector void scale(float amt); // Scales the CVector by the amount passed in float magnitude() const; // Returns the magnitude of the CVector // Cross product void crossProduct(const CVector &vec, CVector &result) const; CVector crossProduct(const CVector &vec) const; // Public data float x; float y; float z; }; // Typedef typedef CVector CPos; #endif