Photon.h

Go to the documentation of this file.
00001 /* $Id:$ */
00002 
00003 #ifndef __PHOTON_H
00004 #define __PHOTON_H
00005 
00006 #include <esg/Definitions.h>
00007 
00012 namespace esg {
00013 
00014 class Photon {
00015         friend class PhotonMap; // doe to efficiency ;-)
00016         
00017     protected:
00018         static const double COS_THETA [256];
00019         static const double SIN_THETA [256];
00020         static const double COS_PHI   [256];
00021         static const double SIN_PHI   [256];
00022         
00023         float         _position[3];
00024         Vector3       _power;
00025         unsigned char _phi;   
00026         unsigned char _theta; 
00027         short         _plane;
00028 
00029     public:
00033         Photon ();
00034 
00042         Photon (const Vector3& pos, const Vector3& dir, const Vector3& pow);
00043 
00049         Photon (const Photon& src);
00050         
00051         Photon& operator =(const Photon&);
00052 
00053         virtual ~Photon () {}
00054 
00058         Vector3 getDirection () const {
00059             return Vector3(SIN_THETA[_theta] * COS_PHI[_phi],
00060                            SIN_THETA[_theta] * SIN_PHI[_phi],
00061                            COS_THETA[_theta]
00062                            );
00063         }
00064 
00068         Vector3 getLocation () const { return Vector3(_position[0],
00069                                                       _position[1],
00070                                                       _position[2]); }
00071 
00075         Vector3 getPower() const { return _power; }
00076 
00082         void setLocation(const Vector3& loc) {
00083             _position[0] = loc.x;
00084             _position[1] = loc.y;
00085             _position[2] = loc.z;
00086         }
00087 
00093         friend ostream& operator <<(ostream& out, const Photon& photon) {
00094             out << "Location:  " << photon.getLocation() << endl;
00095             out << "Direction: " << photon.getDirection() << endl;
00096             out << "Power:     " << photon._power << endl;
00097             out << "Plane:     " << photon._plane << endl;
00098             return out;
00099         }
00100 
00101     }; 
00102 };
00103 
00104 #endif // __PHOTON_H

Generated on Wed Jun 28 12:24:28 2006 for esg by  doxygen 1.4.6