Advertisement
Guest User

3D point class [C++] by Bradley Galloway

a guest
May 22nd, 2012
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.85 KB | None | 0 0
  1. class cPoint3{
  2.  
  3. public:
  4.  
  5.     struct{
  6.         float _x, _y, _z;
  7.     };
  8.  
  9.     cPoint3( float x, float y, float z ){
  10.         _x=x;_y=y;_z=z;
  11.     }
  12.  
  13.     cPoint3(){
  14.         //Default Constructor
  15.     }
  16.  
  17.     inline cPoint3 cPoint3::operator+(cPoint3 Class){
  18.         cPoint3 Cache(_x + Class._x, _y + Class._y, _z + Class._z);
  19.         return Cache;
  20.     }
  21.  
  22.     inline cPoint3 cPoint3::operator-(cPoint3 Class){
  23.         cPoint3 Cache(_x - Class._x, _y - Class._y, _z - Class._z);
  24.         return Cache;
  25.     }
  26.  
  27.     inline cPoint3 cPoint3::operator/(cPoint3 Class){
  28.         cPoint3 Cache(_x / Class._x, _y / Class._y, _z / Class._z);
  29.         return Cache;
  30.     }
  31.  
  32.     inline cPoint3 cPoint3::operator*(cPoint3 Class){
  33.         cPoint3 Cache(_x * Class._x, _y * Class._y, _z * Class._z);
  34.         return Cache;
  35.     }
  36.  
  37.     inline cPoint3 cPoint3::operator=(cPoint3 Class){
  38.         cPoint3 Cache(_x = Class._x, _y = Class._y, _z = Class._z);
  39.         return Cache;
  40.     }
  41.  
  42. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement