00001
00020 #ifndef LINLSQ_H
00021 #define LINLSQ_H
00022
00023 #include "points.h"
00024 #include "mod128.h"
00025 #include "varable.h"
00026
00035 class LLSQ
00036 {
00037 friend class PDLSQ;
00038
00039 public:
00040 LLSQ() {
00041 clear();
00042 }
00043 void clear();
00044
00045 void add(
00046 double x,
00047 double y);
00048 void remove(
00049 double x,
00050 double y);
00051 INT32 count() {
00052 return n;
00053 }
00054
00055 double m();
00056 double c(
00057 double m);
00058 double rms(
00059 double m,
00060 double c);
00061 double spearman();
00062
00063 private:
00064 INT32 n;
00065 double sigx;
00066 double sigy;
00067 double sigxx;
00068 double sigxy;
00069 double sigyy;
00070 };
00071
00080 class PDLSQ
00081 {
00082 public:
00083 PDLSQ() {
00084 clear();
00085 }
00086 void clear() {
00087 pos.clear ();
00088 dir.clear ();
00089 }
00090
00091 void add(
00092 const ICOORD &addpos,
00093 const ICOORD &adddir) {
00094 pos.add (addpos.x (), addpos.y ());
00095 dir.add (adddir.x (), adddir.y ());
00096 }
00097 void remove(
00098 const ICOORD &removepos,
00099 const ICOORD &removedir) {
00100 pos.remove (removepos.x (), removepos.y ());
00101 dir.remove (removedir.x (), removedir.y ());
00102 }
00103 INT32 count() {
00104 return pos.count ();
00105 }
00106
00107 float fit(
00108 DIR128 &ang,
00109 float &sin_ang,
00110 float &cos_ang,
00111 float &r);
00112
00113 private:
00114 LLSQ pos;
00115 LLSQ dir;
00116 };
00117
00124 extern double_VAR_H (pdlsq_posdir_ratio, 0.4e-6, "Mult of dir to cf pos");
00127 #endif