-
Notifications
You must be signed in to change notification settings - Fork 0
/
pathCandidate.h
206 lines (171 loc) · 7.03 KB
/
pathCandidate.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
/*************************************
* Author: M. Babai (M.Babai@rug.nl) *
* Version: *
* License: *
*************************************/
#pragma once
#ifndef PATH_CANDIDATE_H
#define PATH_CANDIDATE_H
#include <vector>
#include <set>
#include "auxfunctions.h"
#include "gridNode.h"
#include "CoordGrid.h"
//_________________________ PathCandidate ________________
struct PathCandidate{
public:
// Constructors
PathCandidate();
// Destructor
virtual ~PathCandidate();
// Copy
PathCandidate(PathCandidate const &ot);
// Assignment
PathCandidate& operator=(PathCandidate const &ot);
// Member fuctions
void insertNewNode(CoordGrid &gr, std::vector< GridNode > &Ingrid, GridNode *node, std::vector<int>::iterator it);
void insertNewNodeFinal(CoordGrid &gr, std::vector< GridNode > &Ingrid, GridNode *node, std::vector<int>::iterator it);
bool compareTwoPathsLength(PathCandidate *a, PathCandidate *b) ;
void determineSkewedXY(CoordGrid &gr, std::vector< GridNode > &Ingrid, GridNode *node, size_t vecindex);
void fEstimateSkewedXY(CoordGrid &gr, std::vector< GridNode > &Ingrid, GridNode *node, size_t vecindex);
void addToAnchor(CoordGrid &gr, std::vector< GridNode > &Ingrid,GridNode *node, size_t vecindex, int prevLayer);
void correctPrevAnchor(CoordGrid &gr, std::vector< GridNode > &Ingrid,GridNode *node, size_t vecindex);
inline bool isInCandidate(int nodeId) const;
// Comparison functions
inline friend bool GreaterThanAngle (PathCandidate const &lf, PathCandidate const &rt);
inline friend bool LessThanAngle (PathCandidate const &lf, PathCandidate const &rt);
inline friend bool GreaterThanWeight(PathCandidate const &lf, PathCandidate const &rt);
inline friend bool LessThanWeight(PathCandidate const &lf, PathCandidate const &rt);
inline friend bool GreaterThanLength(PathCandidate const &lf, PathCandidate const &rt);
inline friend bool LessThanLength(PathCandidate const &lf, PathCandidate const &rt);
inline friend bool GreaterThanMaxLayer(PathCandidate const &lf, PathCandidate const &rt);
inline friend bool GreaterThanMaxLayerP(PathCandidate const *lf, PathCandidate const *rt);
inline friend bool GreaterThanMinLayer(PathCandidate const &lf, PathCandidate const &rt);
inline friend bool LessThanMaxLayer(PathCandidate const &lf, PathCandidate const &rt);
inline friend bool LessThanMinLayer(PathCandidate const &lf, PathCandidate const &rt);
// bool compareTwoPathsLength(PathCandidate lf, PathCandidate rt);
bool compareTwoPathsLength (PathCandidate const *lf, PathCandidate const *rt);
// Member variables and containers
unsigned int m_id;
unsigned int m_level;
unsigned int m_weight;// Number of member nodes
float m_orientation;// The orientation in radians
float m_scattAngle;//
bool m_OuterToInner;// Direction of the path
unsigned int m_length;// Length of the path (>= 1)
bool m_isValid;
bool m_isShort;// If it has less length(weight) than min
bool m_isMerged;
bool m_hasCurvature;
CurvatureParameters m_CurV_par;// Estimate of curvature
// Ids of the head and tail nodes. Non virtual
int m_maxlayerNodeId;//id of node with max layer
int m_minlayerNodeId;//id of node with min layer
size_t m_maxLayernodeLayer;// Layer number of max
size_t m_minlayerNodeLayer;// Layer number of min
int m_maxLayerNodeId;//id of node with max layer
int m_minLayerNodeId;//id of node with min layer
int m_maxLayer; //Layer number of max//id of node with max layer
int m_minLayer;// Layer number of min//id of node with min layer
int m_nPerLayer;
int m_lastNodeVirtual;//id of node with min layer
// int m_lastNodeVirtualId;//id of node with min layer
int m_finished;
bool m_isOnSectorLimit;
bool m_startOnSectorLimit;
int m_headNode;
int m_tailNode;
int m_lastNodeAdded;
int m_seenVirtual;//id of node with min layer
int m_lastVirtual;
int m_numVirtual;
std::vector<int> *m_memberList;// List of members in a vector(delete me)
std::set<int> *m_memberIdSet;// The set of member ids
std::vector<int> m_prevVirtuals;
std::vector<unsigned int> m_toMergeHead;
std::vector<unsigned int> m_toMergeTail;
std::vector<unsigned int> m_sectors;
std::vector<int> m_layers;
std::vector<int> m_headNeigh;
std::vector<int> m_tailNeigh;
std::vector<unsigned int> m_listSkewed;
std::vector<double> m_x;// List of x
std::vector<double> m_y;// List of y
std::vector<double> m_z;// List of z
std::vector<double> m_r;// List of r
std::vector<double> m_theta;// List of theta
std::vector<GridNode> m_anchors;// List of theta
/* Shape and spread parameters */
std::vector< float > m_meanVector;
std::vector< std::vector<float> > m_covMatrix;
std::vector< std::vector<float> > m_inveCovMatrix;
float m_eigevValue1;
float m_eigevValue2;
std::vector<float> m_eigenVector1;
std::vector<float> m_eigenVector2;
// The list of parents and childeren
std::vector<unsigned int> m_parents;
std::vector<unsigned int> m_childeren;
//_________ Protected functions and members _______
//protected:
//_________ Private functions and members _______
private:
bool operator==(PathCandidate const &ot) const;
bool operator<(PathCandidate const &ot) const;
bool operator>(PathCandidate const &ot) const;
};
//________________________ END PathCandidate ______________
// Inline implementations
bool GreaterThanAngle (PathCandidate const &lf, PathCandidate const &rt)
{
return (lf.m_orientation > rt.m_orientation);
}
bool LessThanAngle (PathCandidate const &lf, PathCandidate const &rt)
{
return (lf.m_orientation < rt.m_orientation);
}
bool GreaterThanWeight(PathCandidate const &lf, PathCandidate const &rt)
{
return (lf.m_weight > rt.m_weight);
}
bool LessThanWeight(PathCandidate const &lf, PathCandidate const &rt)
{
return (lf.m_weight < rt.m_weight);
}
bool GreaterThanLength(PathCandidate const &lf, PathCandidate const &rt)
{
return (lf.m_length > rt.m_length);
}
bool LessThanLength(PathCandidate const &lf, PathCandidate const &rt)
{
return (lf.m_length > rt.m_length);
}
bool GreaterThanMaxLayer(PathCandidate const &lf, PathCandidate const &rt)
{
return (lf.m_maxLayernodeLayer > rt.m_maxLayernodeLayer);
}
bool GreaterThanMaxLayerP(PathCandidate const *lf, PathCandidate const *rt)
{
return ( GreaterThanMaxLayer( (*lf), (*rt) ) );
}
bool LessThanMaxLayer(PathCandidate const &lf, PathCandidate const &rt)
{
return (lf.m_maxLayernodeLayer < rt.m_maxLayernodeLayer);
}
bool GreaterThanMinLayer(PathCandidate const &lf, PathCandidate const &rt)
{
return (lf.m_minlayerNodeLayer > rt.m_minlayerNodeLayer);
}
bool LessThanMinLayer(PathCandidate const &lf, PathCandidate const &rt)
{
return (lf.m_minlayerNodeLayer < rt.m_minlayerNodeLayer);
}
bool PathCandidate::isInCandidate(int nodeId) const
{
return( (m_memberIdSet->find(nodeId)) != m_memberIdSet->end() );
}
bool compareTwoPathsLength (PathCandidate const *lf, PathCandidate const *rt)
{
return (lf->m_length > rt->m_length);
}
#endif// END header