Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members

Path.H

Go to the documentation of this file.
00001 
00010 #ifndef PATH_H
00011 #define PATH_H
00012 
00013 // Gluebase includes
00014 #define OUTSIDE_GLUE_CORE
00015 #include <mlib/points.H>
00016 #include <std/hash.H>
00017 #include <std/strings.H>
00018 
00019 namespace InSpace {
00020 
00021 class Interpolator;
00022 
00023 class Path
00024 {
00025 public:
00026   Path();
00027   virtual ~Path();  
00028 
00029   virtual void addPoint(const Wtransf& trans,const double cumulLength=-1);
00030   virtual void setPoint(const int pt,const Wtransf trans,const Wtransf roomtrans);
00031 
00032   virtual double getLength() const;
00033   virtual int getNumPoints() const;
00034 
00035   virtual Wtransf& getTransAbsolute(const int num);
00036   
00037   //dist[0,length)
00038   virtual Wtransf getTrans(const double dist);
00039   //dist [0,1)
00040   virtual Wtransf getTransRelative(const double dist);
00041 
00042   //returns length at an int (transform)
00043   virtual double getLengthAt(const int num);
00044 
00045   //length [0,length)
00046   virtual int getIndex(double length);
00047 
00048   //methods to determine distance from the Path, and closest point on the Path
00049   //assume the point is in the same coordinate frame as the Path
00050   virtual Wvec distanceFrom(const Wpt pt,int start=0,int end=50000);
00051   virtual Wtransf closestPoint(const Wpt pt,int start=0,int end=50000);
00052   virtual double getPercentAt(const Wpt pt,int start=0,int end=50000);
00053 
00054   //methods to determine the closest pt on path given a ray
00055   virtual double getPercentAt(const Wpt pt, const Wvec vec,int start=0,int end=50000);
00056 
00057   //result is parameter path-this
00058   virtual Path* difference(Path* path,int numsteps=400);
00059 
00060   virtual Path* sum(Path* path, int numsteps=400);
00061   virtual Path* lengthSum(Path* path);
00062 
00063   //returns path from startDist of length length
00064   virtual Path* getSubPath(double startDist,double length);
00065 
00066   virtual void leftmodify(const Wtransf trans);
00067   virtual void rightmodify(const Wtransf trans);
00068 
00069   virtual Path* getSuffixAbsolute(const int trans);
00070   //dist[0,length)
00071   virtual Path* getSuffix(const double dist);
00072   //dist[0,1)
00073   virtual Path* getSuffixRelative(const double dist);
00074 
00075   virtual ARRAY<Path*> getPathsOfLength(double length, int skipval);
00076 
00077 
00078   virtual bool isEqual(Path* path);
00079 
00080   virtual bool isSignificantlyDifferent(Path* path, double threshold);
00081 
00082   virtual void setReferenceLength(const double l){_referenceLength=l;};
00083   virtual double getReferenceLength() const{return _referenceLength;};
00084 
00085   virtual void recalcLength();
00086   virtual Path* getCopy();
00087   virtual void print();
00088 
00089   virtual void setChanged(bool c){_changed=c;};
00090   virtual bool getChanged(){return _changed;};
00091 
00092   virtual ARRAY<Wtransf>& getPts(){return _pts;};
00093   virtual ARRAY<double>& getCumulativeLength(){return _cumulativeLength;};
00094  
00095 
00096 protected:
00097   virtual void updateLength();
00098 
00099   //distance between segment L1 and line L2
00100   virtual float dist3D_Line_to_Line(Wpt L1a,Wpt L1b,Wpt L2a,Wvec L2v,double& L1t);
00101 
00102   ARRAY<Wtransf> _pts;
00103   //I don't really know why we are keeping track of this, but its there
00104   //ARRAY<Wtransf> _roomPts;
00105 
00106   ARRAY<double>  _cumulativeLength;
00107   double _length;
00108 
00109   double _referenceLength;
00110 
00111   Interpolator* _interp;
00112   
00113   //hack for interpolator to indicate whether a path has changed
00114   bool _changed;
00115   
00116   Wtransf temptrans;
00117 };
00118 
00119 //saving/loading operators
00120 ostream & operator <<(ostream &os, Path &p);
00121 Path* readPath(istream *ifs);
00122 
00123 }
00124 #endif

Generated on Thu Jul 8 15:19:28 2004 for inspace by doxygen 1.3.4