#ifndef __D3Vector__H__ #define __D3Vector__H__ class D3Vector { public: __device__ D3Vector(){ x = 0, y = 0, z = 0; } __device__ D3Vector(const float3 &v){ x = v.x; y = v.y; z = v.z; } __device__ D3Vector(float x, float y, float z){ this->x = x; this->y = y; this->z = z; } float x, y, z; __device__ float Dot(const D3Vector &v)const{ return (x * v.x + y * v.y + z * v.z); } __device__ D3Vector operator-(const D3Vector &a)const{ return D3Vector(x-a.x, y-a.y, z-a.z); } __device__ D3Vector operator+(const D3Vector &a)const{ return D3Vector(x+a.x, y+a.y, z+a.z); } //__device__ D3Vector operator*(const double a)const{ // return D3Vector(x*a, y*a, z*a); //} }; __device__ D3Vector operator*(const double a, const D3Vector &b){ return D3Vector(b.x*a, b.y*a, b.z*a); } #endif //__D3Vector__H__