Function used in testing to determine if a returns list of waypoints is a good zigzag.
103 {
104
105 bool bZigZag = false;
106 double dExpectedSlope = 0.0;
107
108
109 if (vPoints.size() < 3)
110 {
111 return false;
112 }
113
114
115 for (size_t siIter = 1; siIter < vPoints.size(); ++siIter)
116 {
117
118 double dSlope =
atan2(vPoints[siIter].GetUTMCoordinate().dNorthing - vPoints[siIter - 1].GetUTMCoordinate().dNorthing,
119 vPoints[siIter].GetUTMCoordinate().dEasting - vPoints[siIter - 1].GetUTMCoordinate().dEasting);
120
121
122 if (siIter > 1)
123 {
124
125 double dPrevSlope =
atan2(vPoints[siIter - 1].GetUTMCoordinate().dNorthing - vPoints[siIter - 2].GetUTMCoordinate().dNorthing,
126 vPoints[siIter - 1].GetUTMCoordinate().dEasting - vPoints[siIter - 2].GetUTMCoordinate().dEasting);
127
128 if (std::abs(dSlope - dPrevSlope) > dSlopeThreshold)
129 {
130
131 if ((dSlope - dPrevSlope) == dExpectedSlope)
132 {
133
134 bZigZag = true;
135 }
136 else
137 {
138 return false;
139 }
140 }
141 }
142
143 if (siIter < vPoints.size() - 1)
144 {
145
146 double dNextSlope =
atan2(vPoints[siIter + 1].GetUTMCoordinate().dNorthing - vPoints[siIter].GetUTMCoordinate().dNorthing,
147 vPoints[siIter + 1].GetUTMCoordinate().dEasting - vPoints[siIter].GetUTMCoordinate().dEasting);
148
149 if (std::abs(dSlope - dNextSlope) > dSlopeThreshold)
150 {
151
152 dExpectedSlope = -(dSlope - dNextSlope);
153 }
154 }
155 }
156
157
158 return bZigZag;
159 }
__device__ __forceinline__ float1 atan2(const uchar1 &a, const uchar1 &b)