00001 /* 00002 File: Ray.h 00003 00004 Copyright(C) C. Kotterink, Computed Graphics 00005 */ 00006 #ifndef RAY_H 00007 #define RAY_H 00008 00009 #include<Vertex3.h> 00010 #include<Matrix4.h> 00011 00018 class Ray 00019 { 00020 public: 00022 Ray() {}; 00023 00025 Ray(const Ray &ray); 00026 00028 Ray(const Vertex3 origin, const Vertex3 direction); 00029 00031 const Vertex3 &origin() const { return o; } 00032 00034 const Vertex3 &direction() const { return d; } 00035 00037 void setOrigin(const Vertex3 &origin) { 00038 o = origin; 00039 } 00040 00042 void setDirection(const Vertex3 &direction) { 00043 d = direction; 00044 } 00045 00047 void transform(const Matrix4 &M); 00048 00055 void transformOrigin(const Matrix4 &M) { 00056 o = M*o; 00057 } 00058 00059 //private: 00061 Vertex3 o; 00062 00064 Vertex3 d; 00065 }; 00066 #endif