00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00030 #ifndef __MULTI_REG_CAM_H_
00031 #define __MULTI_REG_CAM_H_
00032
00033 #define BLACK "\e[2;30m"
00034 #define RED "\e[0;31m"
00035 #define GREEN "\e[0;32m"
00036 #define YELLOW "\e[0;33m"
00037 #define BLUE "\e[0;34m"
00038 #define MAGENTA "\e[0;35m"
00039 #define CYAN "\e[0;36m"
00040 #define WHITE "\e[0;37m"
00041 #define STOPCOLOR "\e[m"
00042
00043 #include <MIPMatrix.h>
00044 #include "time.h"
00045 #include <fstream>
00046 #include <stdlib.h>
00047 #include <stdio.h>
00048 #include <vector>
00049 #include <iostream>
00050 #include <R2.h>
00051 #include <S1.h>
00052 #include <SE2.h>
00053 #include "MultiRegCamStr.h"
00054
00055
00056 using namespace std;
00057 using namespace MipBaselib;
00058
00059 namespace MipAlgorithms{
00060
00061 class MultiRegCamPar {
00062 private:
00063 Decimal _linearTollerance;
00064 Decimal _angularTollerance;
00065 Decimal _projTollerance;
00066
00067 public:
00069 MultiRegCamPar();
00070
00072 MultiRegCamPar(Decimal lt, Decimal at, Decimal pt);
00073
00075 MultiRegCamPar(const MultiRegCamPar &A);
00076
00078 MultiRegCamPar& operator=(MultiRegCamPar &A);
00079
00081
00082 Decimal getLinearTollerance();
00083
00085
00086 Decimal getAngularTollerance();
00087
00089 Decimal getProjTollerance();
00090 };
00091
00092 class MultiRegCamSol {
00093 private:
00095 vector<PolFusion*> _sols;
00096
00097 public:
00099
00100 MultiRegCamSol();
00101
00103
00104 MultiRegCamSol(PolFusion *polFusion);
00105
00106 ~MultiRegCamSol();
00107
00109
00110 void insertPol(PolFusion *polFusion);
00111
00113
00114 int getSize();
00115
00117
00118 PolFusion* getPolFusion(int pos);
00119
00120 vector<PolFusion*> getActualSol();
00121
00122 MultiRegCamSol& operator=(MultiRegCamSol &A);
00123
00124 int searchId(int id, vector<Pose> *ris, vector<MIPMatrix> *measCov, Decimal *rightProb);
00125
00126 string printSolutions(vector<Pose> *ris);
00127
00129
00130 string print(int opt = 0);
00131
00132 };
00133
00134 class MultiRegCam {
00135 public:
00136 MultiRegCamPar _par;
00137
00139 MultiRegCam(MultiRegCamPar par);
00140
00142 ~MultiRegCam();
00143
00145 void initExample(vector<AngleId> &input);
00146
00148 void print(vector<AngleId> input, int option);
00149
00151 void print(vector< vector<Decimal> > input);
00152
00154 void initTriangles(vector<AngleId> input, MultiRegCamSol *mrcsols, int myId);
00155
00156
00157 vector <vector<Angle> > createAng(vector<vector<Angle> > input);
00158
00159 vector <vector<Decimal> > findFormTot(vector<vector<Angle> > input);
00160
00162 void evalTria(vector<AngleId> input,int firstV,int firstF,int firstS,int secondV,int secondF,int secondS,int thirdV,int thirdF,int thirdS,Decimal aSide,Decimal bSide,Decimal cSide,Triangle *triaPointer);
00163
00164
00165
00167 int step(int argc, char** argv);
00168
00169
00170
00172 void eraseDup(Triangle* &triaPointer, Decimal thr);
00173
00175 void eraseDup3(Triangle* &triaPointer, Decimal thr);
00176
00177 bool eraseDupTria(vector<Triangle*> &trias, Triangle* &tria);
00178
00180 void createPol(vector<Triangle*> triaSols, int myId,MultiRegCamSol *mrcsols);
00181
00183 void quickSortTria(vector<Triangle*> &triaSols, Triangle* &tria, int myId);
00184
00186 void selectSubSol(vector<Triangle*> &triaSols, Triangle* &tria, int myId);
00187
00189 void printDataIn(AngleId* first,int f1,int f2, AngleId* second, int s1, int s2, AngleId* third, int t1, int t2,int info1,int info2, int info3, int id1, int id2, int id3);
00190
00191 fstream _logMultiRegCamFile;
00193
00194
00195
00196
00197 };
00198
00199
00200
00201 }
00202
00203 #endif
00204
00205
00206
00207
00208
00209
00210
00212
00213
00214
00215
00216
00218
00219
00220
00221
00222
00223
00225
00226
00227
00228
00229
00231
00232
00233
00234
00236
00237
00238
00239
00240
00241
00242
00243
00244
00245
00246
00247
00248
00249
00251
00252
00253
00254
00255
00256
00257
00258
00259
00260
00261
00262
00263
00265
00266
00267
00269
00270
00271
00272
00274
00275
00276
00277
00278
00279
00280
00281
00282
00284
00285
00286
00287
00289
00290
00291
00292
00293
00294
00295
00296
00297
00299
00300
00301
00302
00303
00304
00305
00306
00307
00308
00309