www.pudn.com > Ray_Tracing_Materials.rar > CVector.h, change:2005-03-02,size:2083b


/* 
   Class Name: 
 
      CVector4. 
 
   Created by: 
 
      Allen Sherrod (Programming Ace of www.UltimateGameProgramming.com). 
 
   Description: 
 
      This class represents a 3D point for a vertex's x, y, z, and w axis. 
*/ 
 
 
#ifndef CVECTOR_H 
#define CVECTOR_H 
 
 
#include<math.h> 
 
 
class CVector4 
{ 
   public: 
      CVector4();                                        // Constructor. 
      CVector4(float X, float Y, float Z);               // Overloaded constructor. 
      CVector4(float X, float Y, float Z, float W);      // Overloaded constructor again. 
 
      void operator=(CVector4 v);                        // Overloaded = sign. 
      CVector4 operator-(CVector4 v);                    // Overloaded - sign. 
      CVector4 operator+(CVector4 v);                    // Overloaded + sign. 
      CVector4 operator*(CVector4 v);                    // Overloaded * sign. 
      CVector4 operator/(CVector4 v);                    // Overloaded / sign. 
      void operator +=(CVector4 v);                      // Overloaded += sign. 
      void operator -=(CVector4 v);                      // Overloaded -= sign. 
      void operator *=(CVector4 v);                      // Overloaded *= sign. 
      void operator /=(CVector4 v);                      // Overloaded /= sign. 
      bool operator ==(CVector4 v);                      // Overloaded == sign. 
      bool operator !=(CVector4 v);                      // Overloaded != sign. 
 
      void CrossProduct(CVector4 v1, CVector4 v2);       // Stores cross product of v1, v2. 
      float DotProduct3(CVector4 v1);                    // Dot 3 on v1 and this. 
      float GetLength();                                 // Return this objects length. 
      void Normal();                                     // Normalize this vector. 
 
      float x, y, z, w;                                  // vertex's x, y, and z info. 
}; 
 
#endif 
 
 
// Copyright February 2005 
// All Rights Reserved! 
// Allen Sherrod 
// ProgrammingAce@UltimateGameProgramming.com 
// www.UltimateGameProgramming.com