Advertisement
Guest User

vec3.h

a guest
Mar 15th, 2011
423
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.73 KB | None | 0 0
  1. /*
  2.  * File:   vec3.h
  3.  * Author: peixinho
  4.  *
  5.  * Created on March 15, 2011, 10:19 AM
  6.  */
  7.  
  8. #ifndef VEC3_H
  9. #define VEC3_H
  10. #include <sstream>
  11. #include <iostream>
  12. #include <math.h>
  13.  
  14. namespace SelFish3D {
  15.  
  16.     using namespace std;
  17.  
  18.     class vec3 {
  19.         public:
  20.  
  21.             float x,y,z;
  22.  
  23.             vec3();
  24.             vec3(const float &x, const float &y, const float &z);
  25.            
  26.             float dotProduct(const vec3 &v) const;
  27.             float magnitude() const;
  28.             float magnitudeSQR() const;
  29.             float distance(const vec3 &v) const;
  30.             float distanceSQR(const vec3 &v) const;
  31.  
  32.             vec3 cross(const vec3 &v) const;
  33.             vec3 normalize() const;
  34.             vec3 clone() const;
  35.             vec3 negate() const;                        
  36.  
  37.             string toString() const;
  38.  
  39.             vec3 operator+(const vec3 &v) const;
  40.             vec3 operator-(const vec3 &v) const;
  41.             vec3 operator*(const vec3 &v) const;
  42.             vec3 operator/(const vec3 &v) const;
  43.             vec3 operator+(const float &f) const;
  44.             vec3 operator-(const float &f) const;
  45.             vec3 operator*(const float &f) const;
  46.             vec3 operator/(const float &f) const;
  47.             void operator+=(const vec3 &v);
  48.             void operator-=(const vec3 &v);
  49.             void operator*=(const vec3 &v);
  50.             void operator/=(const vec3 &v);
  51.             void operator+=(const float &f);
  52.             void operator-=(const float &f);
  53.             void operator*=(const float &f);
  54.             void operator/=(const float &f);
  55.             bool operator==(const vec3 &v) const;
  56.  
  57.             virtual ~vec3();
  58.         private:
  59.  
  60.     };
  61.  
  62. }
  63.  
  64. #endif  /* VEC3_H */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement