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
00031 #ifndef __PROB_MULTI_REG_CAM_STR_H
00032 #define __PROB_MULTI_REG_CAM_STR_H
00033
00034 #include <MIPMatrix.h>
00035 #include "time.h"
00036 #include <fstream>
00037 #include <stdlib.h>
00038 #include <stdio.h>
00039 #include <vector>
00040 #include <iostream>
00041 #include <R2.h>
00042 #include <S1.h>
00043 #include <SE2.h>
00044 #include <map>
00045 #include <MultiRegCamStr.h>
00046
00047 namespace MipAlgorithms {
00048
00049 class ProbPolFusion {
00050 private:
00051 vector<Triangle*> _triangles;
00052 vector<PosId> _vertex;
00053 vector<Angle> _ori;
00054 InterPoints _intThree;
00055 vector<Triangle*> _triangleQueue;
00056 vector<MIPMatrix> _rotoTrasl;
00057 vector<Decimal> _scaleF;
00058 int _ratingVertex;
00059 int _ratingInThree;
00060 vector<int> _numIntFour;
00061 int _expandMethod;
00062
00063 public:
00065 ProbPolFusion();
00066
00068 ProbPolFusion(Triangle* tria, int expMth);
00069
00071 ~ProbPolFusion();
00072
00074 Triangle* getTriangle(int pos);
00075
00077 void setTriangle(int pos,Triangle* tria);
00078
00080 void deleteTriangle(int pos);
00081
00082 void deleteLastTriangle();
00083
00085 void deleteBifConflicts(int pos,int posAt, int idNew);
00086
00087 void deleteBifConflictsOpt(int pos, int idNew);
00088
00090
00091
00092
00093
00095 int getSize();
00096
00098 int getQueueSize();
00099
00101 void getIds(vector<int> &ids);
00102
00104 void insertVertex(PosId vertex);
00105
00107 PosId getVertex(int pos);
00108
00109 void setVertex(int pos,PosId vertex);
00110
00112 void setQueue(Triangle* queue);
00113
00115 int queueSize();
00116
00118 void deleteQueueTriangle(int pos);
00119
00120 void deleteQueueLastTriangle();
00121
00123 void setScale(int i, Decimal scale);
00124
00126 void setScale(Decimal scale);
00127
00129 Decimal getScale(int i);
00130
00132 void deleteScaleF(int pos);
00133
00134 void deleteLastScaleF();
00135
00137 void setRotoTrasl(int pos, MIPMatrix rt);
00138
00140 void deleteRotoTrasl(int pos);
00141
00142 void deleteLastRotoTrasl();
00143
00145 void insertOri(Decimal ori);
00146
00148 Decimal getOri(int pos);
00149
00151 void setOri(int pos,Angle ori);
00152
00154 void deleteOri(int pos);
00155
00156 void deleteLastOri();
00157
00159 void insertTriangle(Triangle *tria, int myId, int id1, int id2);
00160
00162 PosId* searchVertex(int id);
00163
00164 PosId* searchVertex(int id,int &posAt);
00165
00167 void deleteVertex(int pos);
00168
00169 void deleteLastVertex();
00170
00172 int searchBif(PosId vertex,int &posAt,Decimal thr);
00173
00175 void insertPoints(Triangle* tria, int &numInt4);
00176
00178 void insertPointsNoIn(Triangle* tria, int &numInt4, MIPMatrix* &matrixPointer, Decimal actualScale, vector<Position> &intToInsert, int &incrRatInThree);
00179
00181 int getNInThree(int pos);
00182
00184 Position getIntThree(int pos);
00185
00187 Position getLastIntThree();
00188
00190 void deleteIntThree(int pos);
00191
00192 void deleteLastIntThree();
00193
00195 void insertPointIntThree(Position ip,int pos);
00196
00197 bool expandPol(int myId, vector<ProbPolFusion*> actualSol, vector<ProbPolFusion*> &bifProbPolFusion,Decimal linThr, map <int, vector<Pose> > *likelihood, vector <int> activeLikelihoods,Pose &myPose);
00198
00200 bool expandPolOpt(int myId, vector<ProbPolFusion*> actualSol, vector<ProbPolFusion*> &bifProbPolFusion,Decimal linThr, map <int, vector<Pose> > *likelihood, vector <int> activeLikelihoods,Pose &myPose,int &maxBifSize);
00201
00203 bool expandPolNoIn(int myId, vector<ProbPolFusion*> actualSol, vector<ProbPolFusion*> &bifProbPolFusion,Decimal linThr, map <int, vector<Pose> > *likelihood, vector <int> activeLikelihoods,Pose &myPose,int &maxBifSize);
00204
00206
00207 bool checkBif(PosId vertex,Decimal thr,int myId);
00208
00210 string print(int opt=0);
00211
00213 ProbPolFusion& operator=(ProbPolFusion &A);
00214
00216 Decimal computeProbability(Pose measure, int id, map <int, vector<Pose> > * &likelihood);
00217
00219 void setRatingVertex(int rating);
00220
00222 int getRatingVertex();
00223
00225 void growRatingVertex();
00226
00228 void decreaseRatingVertex();
00229
00231 void setRatingInThree(int rating);
00232
00234 int getRatingInThree();
00235
00237 void growRatingInThree();
00238
00240 void decreaseRatingInThree();
00241
00243 void setIntFourNum(int pos, int val);
00244
00246 int getIntFourNum(int pos);
00247
00249 int getLastIntFourNum();
00250
00252 void deleteLastIntFourNum();
00253
00254
00256 void selectScale(Decimal &bestScale, Decimal &bestProb, map <int, vector<Pose> > * &likelihood, vector <int> &activeLikelihoods,vector<int> &idsV,Pose &myPose);
00257
00259 void setExpandMethod(int expMth);
00260 };
00261
00262 }
00263
00264 #endif