00001
00010 #ifndef PATH_H
00011 #define PATH_H
00012
00013
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
00036 virtual Wtransf getTrans(const double dist);
00037
00038 virtual Wtransf getTransRelative(const double dist);
00039
00040
00041 virtual double getLengthAt(const int num);
00042
00043
00044 virtual int getIndex(double length);
00045
00046
00047
00048 virtual Wvec distanceFrom(const Wpt pt);
00049 virtual Wtransf closestPoint(const Wpt pt);
00050 virtual double getPercentAt(const Wpt pt);
00051
00052
00053 virtual double getPercentAt(const Wpt pt, const Wvec vec);
00054
00055
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
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
00069 virtual Path* getSuffix(const double dist);
00070
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
00098 virtual float dist3D_Line_to_Line(Wpt L1a,Wpt L1b,Wpt L2a,Wvec L2v,double& L1t);
00099
00100 ARRAY<Wtransf> _pts;
00101
00102
00103
00104 ARRAY<double> _cumulativeLength;
00105 double _length;
00106
00107 double _referenceLength;
00108
00109 Interpolator* _interp;
00110
00111
00112 bool _changed;
00113
00114 Wtransf temptrans;
00115 };
00116
00117
00118 ostream & operator <<(ostream &os, Path &p);
00119 Path* readPath(istream *ifs);
00120
00121 #endif