Main Page | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | Directories | File List | Namespace Members | Data Fields | Globals

SourceInfo.h

Go to the documentation of this file.
00001 
00002 #include "Object.h"
00003 #include "ObjectParser.h"
00004 #include <cmath>
00005 #include "misc.h"
00006 
00007 class SourceInfo : public FD::Object {
00008 public:
00009    float delta[7];
00010    float x[3];
00011    float strength;
00012    int age;
00013    int interval;
00014    int eval_count;
00015    int start_time;
00016    int source_id;
00017    double remaining;
00018 
00019    float angle(const float *y) const
00020    {
00021       float prod = x[0]*y[0] + x[1]*y[1] + x[2]*y[2];
00022       if (prod < -1)
00023          prod=-1;
00024       if (prod>1)
00025          prod = 1;
00026       return std::acos(prod);
00027    }
00028    float angle(const SourceInfo &s) const {return std::acos(x[0]*s.x[0] + x[1]*s.x[1] + x[2]*s.x[2]);}
00029    void printOn(std::ostream &out=std::cout) const;
00030 
00031    FD::ObjectRef clone()
00032    {
00033       return FD::ObjectRef(new SourceInfo(*this));
00034    }
00035    
00036    void readFrom(std::istream &in)
00037    {
00038    }
00039    friend std::istream &operator >> (std::istream &in, SourceInfo &cell);
00040 };
00041 
00042 inline std::istream &operator >> (std::istream &in, SourceInfo &src)
00043 {
00044    if (!FD::isValidType(in, "SourceInfo")) return in;
00045    src.readFrom(in);
00046    return in;
00047 }

Generated on Wed Oct 5 14:36:11 2005 for RobotFlow by  doxygen 1.4.4