00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #ifndef TLINE2D_FLAG_
00014 #define TLINE2D_FLAG_
00015
00016 #ifdef TRKRECO_DEBUG_DETAIL
00017 #ifndef TRKRECO_DEBUG
00018 #define TRKRECO_DEBUG
00019 #endif
00020 #endif
00021 class TPoint2D;
00022 template <class T> class CAList;
00023
00025 class TLine2D {
00026
00027 public:
00029 TLine2D();
00030 TLine2D(double slope, double yOffset);
00031 TLine2D(const AList<TPoint2D> &);
00032
00034 virtual ~TLine2D();
00035
00036 public:
00037 double slope(void) const;
00038 double yOffset(void) const;
00039 double xOffset(void) const;
00040
00041 public:
00042 double slope(double);
00043 double yOffset(double);
00044
00045 public:
00046 int fit(void);
00047 double det(void) const;
00048
00049 public:
00050 double distance(const TPoint2D &) const;
00051
00052 public:
00053 void append(const TPoint2D &);
00054 void remove(const TPoint2D &);
00055 const CAList<TPoint2D> & list(void) const;
00056
00057 private:
00058 double _slope;
00059 double _yOffset;
00060 double _det;
00061 mutable CAList<TPoint2D> * _list;
00062 };
00063
00064
00065
00066 #ifdef TLINE2D_NO_INLINE
00067 #define inline
00068 #else
00069 #undef inline
00070 #define TLINE2D_INLINE_DEFINE_HERE
00071 #endif
00072 #ifdef TLINE2D_INLINE_DEFINE_HERE
00073
00074 inline
00075 double
00076 TLine2D::slope(void) const {
00077 return _slope;
00078 }
00079
00080 inline
00081 double
00082 TLine2D::yOffset(void) const {
00083 return _yOffset;
00084 }
00085
00086 inline
00087 double
00088 TLine2D::xOffset(void) const {
00089 return - _yOffset / _slope;
00090 }
00091
00092 inline
00093 double
00094 TLine2D::slope(double a) {
00095 return _slope = a;
00096 }
00097
00098 inline
00099 double
00100 TLine2D::yOffset(double a) {
00101 return _yOffset = a;
00102 }
00103
00104 #endif
00105 #undef inline
00106
00107 #endif