SHARE
TWEET

GLSL tutorial 1 - vector3d.h

thecplusplusguy Jul 26th, 2012 2,802 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //http://www.youtube.com/user/thecplusplusguy
  2. #ifndef VECTOR3D_H
  3. #define VECTOR3D_H
  4. #include <iostream>
  5. #include <cmath>
  6.  
  7. class vector3d{
  8.         public:
  9.                 float x,y,z;
  10.                 vector3d();
  11.                 vector3d(float a,float b);
  12.                 vector3d(float a,float b,float c);
  13.                
  14.                 float dotProduct(const vector3d& vec2);
  15.                 vector3d crossProduct(const vector3d& vec2);
  16.                 float length();
  17.                 void normalize();
  18.                
  19.                 void change(float a,float b,float c);
  20.                 void change(vector3d vec2);
  21.                 void changeX(float a);
  22.                 void changeY(float a);
  23.                 void changeZ(float a);
  24.                
  25.                 vector3d operator+(const vector3d& vec2);
  26.                 vector3d operator-(const vector3d& vec2);
  27.                 vector3d operator*(float num);
  28.                 vector3d operator/(float num);
  29.                
  30.                 vector3d& operator+=(const vector3d& vec2);
  31.                 vector3d& operator-=(const vector3d& vec2);
  32.                 vector3d& operator*=(float num);
  33.                 vector3d& operator/=(float num);       
  34.                
  35.                 bool operator==(const vector3d vec2);
  36.                 bool operator!=(const vector3d vec2);
  37.                
  38.                 friend std::ostream& operator<<(std::ostream& out,const vector3d& vec);
  39. };
  40.  
  41. #endif
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top