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

Generated on Mon Sep 15 16:27:56 2003 for inspace by doxygen1.2.18