Branch data Line data Source code
1 : : // ----------------- BEGIN LICENSE BLOCK ---------------------------------
2 : : //
3 : : // Copyright (C) 2020-2021 Intel Corporation
4 : : //
5 : : // SPDX-License-Identifier: LGPL-2.1-only
6 : : //
7 : : // ----------------- END LICENSE BLOCK -----------------------------------
8 : :
9 : : #include "TestSupport.hpp"
10 : : #include "ad/rss/unstructured/Geometry.hpp"
11 : :
12 : : namespace ad {
13 : : namespace rss {
14 : : namespace unstructured {
15 : :
16 : : auto epsilon = 1.e-5;
17 : :
18 : 2 : TEST(GeometryTests, toPoint)
19 : : {
20 : 1 : ad::physics::Distance2D distance;
21 : 1 : distance.x = ad::physics::Distance(1.0);
22 : 1 : distance.y = ad::physics::Distance(2.0);
23 [ + - ]: 1 : auto point = toPoint(distance);
24 [ + - + - : 1 : ASSERT_DOUBLE_EQ(1.0, point.x());
- + - - -
- - - ]
25 [ + - + - : 1 : ASSERT_DOUBLE_EQ(2.0, point.y());
- + - - -
- - - ]
26 : :
27 [ + - ]: 1 : point = toPoint(ad::physics::Distance(2.0), ad::physics::Distance(1.0));
28 [ + - + - : 1 : ASSERT_DOUBLE_EQ(2.0, point.x());
- + - - -
- - - ]
29 [ + - + - : 1 : ASSERT_DOUBLE_EQ(1.0, point.y());
- + - - -
- - - ]
30 : : }
31 : :
32 : 2 : TEST(GeometryTests, toDistance)
33 : : {
34 [ + - + - ]: 1 : ::ad::physics::Distance2D distance = toDistance(Point(1.0, 2.0));
35 [ + - - + : 1 : ASSERT_EQ(ad::physics::Distance(1.0), distance.x);
- - - - -
- ]
36 [ + - - + : 1 : ASSERT_EQ(ad::physics::Distance(2.0), distance.y);
- - - - -
- ]
37 : : }
38 : :
39 : 2 : TEST(GeometryTests, toPolygon)
40 : : {
41 : 1 : world::UnstructuredTrajectorySet trajectorySet;
42 : 1 : ::ad::physics::Distance2D pt;
43 : 1 : pt.x = ::ad::physics::Distance(1.0);
44 : 1 : pt.y = ::ad::physics::Distance(2.0);
45 [ + - ]: 1 : trajectorySet.push_back(pt);
46 [ + - ]: 1 : trajectorySet.push_back(pt);
47 : :
48 [ + - ]: 1 : Polygon polygon;
49 [ + - ]: 1 : toPolygon(trajectorySet, polygon);
50 [ + - + - : 1 : ASSERT_NEAR(1.0, polygon.outer()[0].x(), epsilon);
- + - - -
- - - ]
51 [ + - + - : 1 : ASSERT_NEAR(2.0, polygon.outer()[0].y(), epsilon);
- + - - -
- - - ]
52 [ + - + - : 1 : ASSERT_NEAR(1.0, polygon.outer()[1].x(), epsilon);
- + - - -
- - - ]
53 [ + - + - : 1 : ASSERT_NEAR(2.0, polygon.outer()[1].y(), epsilon);
- + - - -
- - - ]
54 : : }
55 : :
56 : 2 : TEST(GeometryTests, toTrajectorySet)
57 : : {
58 [ + - ]: 1 : Polygon polygon;
59 [ + - + - ]: 1 : boost::geometry::append(polygon, Point(1.0, 2.0));
60 [ + - + - ]: 1 : boost::geometry::append(polygon, Point(1.0, 3.0));
61 : 1 : world::UnstructuredTrajectorySet trajectorySet;
62 [ + - ]: 1 : toTrajectorySet(polygon, trajectorySet);
63 : :
64 [ + - - + : 1 : ASSERT_EQ(::ad::physics::Distance(1.0), trajectorySet[0].x);
- - - - -
- ]
65 [ + - - + : 1 : ASSERT_EQ(::ad::physics::Distance(2.0), trajectorySet[0].y);
- - - - -
- ]
66 [ + - - + : 1 : ASSERT_EQ(::ad::physics::Distance(1.0), trajectorySet[1].x);
- - - - -
- ]
67 [ + - - + : 1 : ASSERT_EQ(::ad::physics::Distance(3.0), trajectorySet[1].y);
- - - - -
- ]
68 : : }
69 : :
70 : 2 : TEST(GeometryTests, isInsideHeadingRange)
71 : : {
72 : 1 : state::HeadingRange range;
73 : 1 : range.begin = physics::cPI;
74 : 1 : range.end = physics::cPI;
75 [ + - - + : 1 : ASSERT_TRUE(isInsideHeadingRange(physics::cPI, range));
- - - - -
- - - ]
76 [ + - + - : 1 : ASSERT_FALSE(isInsideHeadingRange(3. / 2. * physics::cPI, range));
- + - - -
- - - -
- ]
77 : :
78 [ + - ]: 1 : range.begin = 1. / 4. * physics::cPI;
79 [ + - ]: 1 : range.end = 3. / 4. * physics::cPI;
80 [ + - + - : 1 : ASSERT_TRUE(isInsideHeadingRange(1. / 2. * physics::cPI, range));
- + - - -
- - - -
- ]
81 [ + - + - : 1 : ASSERT_FALSE(isInsideHeadingRange(3. / 2. * physics::cPI, range));
- + - - -
- - - -
- ]
82 : :
83 [ + - ]: 1 : range.begin = 3. / 4. * physics::cPI;
84 [ + - ]: 1 : range.end = 1. / 4. * physics::cPI;
85 [ + - + - : 1 : ASSERT_FALSE(isInsideHeadingRange(1. / 2. * physics::cPI, range));
- + - - -
- - - -
- ]
86 [ + - + - : 1 : ASSERT_TRUE(isInsideHeadingRange(3. / 2. * physics::cPI, range));
- + - - -
- - - -
- ]
87 : : }
88 : :
89 : 2 : TEST(GeometryTests, getHeadingOverlap)
90 : : {
91 : 1 : ad::rss::state::HeadingRange a;
92 : 1 : ad::rss::state::HeadingRange b;
93 : 1 : std::vector<ad::rss::state::HeadingRange> overlapRanges;
94 : :
95 : 1 : a.begin = ad::physics::Angle(0.0);
96 : 1 : a.end = ad::physics::cPI;
97 : 1 : b.begin = ad::physics::Angle(0.0);
98 : 1 : b.end = ad::physics::c2PI;
99 [ + - - + : 1 : ASSERT_TRUE(ad::rss::unstructured::getHeadingOverlap(a, b, overlapRanges));
- - - - -
- - - ]
100 [ + - - + : 1 : ASSERT_EQ(1u, overlapRanges.size());
- - - - -
- ]
101 [ + - - + : 1 : ASSERT_EQ(ad::physics::Angle(0.0), overlapRanges[0].begin);
- - - - -
- ]
102 [ + - - + : 1 : ASSERT_EQ(ad::physics::cPI, overlapRanges[0].end);
- - - - -
- ]
103 : :
104 : 1 : a.begin = ad::physics::Angle(0.0);
105 : 1 : a.end = ad::physics::cPI;
106 [ + - ]: 1 : b.begin = ad::physics::cPI / 2.;
107 [ + - ]: 1 : b.end = ad::physics::cPI / 4.;
108 : 1 : overlapRanges.clear();
109 [ + - - + : 1 : ASSERT_TRUE(ad::rss::unstructured::getHeadingOverlap(a, b, overlapRanges));
- - - - -
- - - ]
110 [ + - - + : 1 : ASSERT_EQ(2u, overlapRanges.size());
- - - - -
- ]
111 [ + - - + : 1 : ASSERT_EQ(ad::physics::Angle(0.0), overlapRanges[0].begin);
- - - - -
- ]
112 [ + - + - : 1 : ASSERT_EQ(ad::physics::cPI / 4., overlapRanges[0].end);
- + - - -
- - - ]
113 [ + - + - : 1 : ASSERT_EQ(ad::physics::cPI / 2., overlapRanges[1].begin);
- + - - -
- - - ]
114 [ + - - + : 1 : ASSERT_EQ(ad::physics::cPI, overlapRanges[1].end);
- - - - -
- ]
115 : : }
116 : :
117 : 2 : TEST(GeometryTests, overlapHeadingRange)
118 : : {
119 : 1 : ad::rss::state::HeadingRange headingRange;
120 : 1 : std::vector<ad::rss::state::HeadingRange> overlapRanges;
121 : :
122 : 1 : headingRange.begin = ad::physics::Angle(0.0);
123 : 1 : headingRange.end = physics::cPI;
124 : 1 : ad::rss::state::HeadingRange resultRange;
125 : 1 : resultRange.begin = ad::physics::Angle(0.0);
126 : 1 : resultRange.end = ad::physics::Angle(0.0);
127 [ + - ]: 1 : overlapRanges.push_back(resultRange);
128 [ + - ]: 1 : resultRange.begin = 1. / 4. * physics::cPI;
129 [ + - ]: 1 : resultRange.end = 1. / 2. * physics::cPI;
130 [ + - ]: 1 : overlapRanges.push_back(resultRange);
131 [ + - - + : 1 : ASSERT_TRUE(ad::rss::unstructured::getHeadingOverlap(headingRange, overlapRanges));
- - - - -
- - - ]
132 [ + - - + : 1 : ASSERT_EQ(2u, overlapRanges.size());
- - - - -
- ]
133 [ + - - + : 1 : ASSERT_EQ(ad::physics::Angle(0.0), overlapRanges[0].begin);
- - - - -
- ]
134 [ + - - + : 1 : ASSERT_EQ(ad::physics::Angle(0.0), overlapRanges[0].end);
- - - - -
- ]
135 [ + - + - : 1 : ASSERT_EQ(1. / 4. * physics::cPI, overlapRanges[1].begin);
- + - - -
- - - ]
136 [ + - + - : 1 : ASSERT_EQ(1. / 2. * physics::cPI, overlapRanges[1].end);
- + - - -
- - - ]
137 : :
138 : : // headingRange inside outer
139 : 1 : overlapRanges.clear();
140 [ + - ]: 1 : headingRange.begin = 1. / 4. * physics::cPI;
141 [ + - ]: 1 : headingRange.end = 1. / 2. * physics::cPI;
142 : 1 : resultRange.begin = ad::physics::Angle(0.0);
143 : 1 : resultRange.end = physics::cPI;
144 [ + - ]: 1 : overlapRanges.push_back(resultRange);
145 [ + - - + : 1 : ASSERT_TRUE(ad::rss::unstructured::getHeadingOverlap(headingRange, overlapRanges));
- - - - -
- - - ]
146 [ + - - + : 1 : ASSERT_EQ(1u, overlapRanges.size());
- - - - -
- ]
147 [ + - + - : 1 : ASSERT_EQ(1. / 4. * physics::cPI, overlapRanges[0].begin);
- + - - -
- - - ]
148 [ + - + - : 1 : ASSERT_EQ(1. / 2. * physics::cPI, overlapRanges[0].end);
- + - - -
- - - ]
149 : :
150 : : // headingRange intersects with outer, is higher
151 : 1 : overlapRanges.clear();
152 [ + - ]: 1 : headingRange.begin = 1. / 2. * physics::cPI;
153 [ + - ]: 1 : headingRange.end = 3. / 2. * physics::cPI;
154 : 1 : resultRange.begin = ad::physics::Angle(0.0);
155 : 1 : resultRange.end = physics::cPI;
156 [ + - ]: 1 : overlapRanges.push_back(resultRange);
157 [ + - - + : 1 : ASSERT_TRUE(ad::rss::unstructured::getHeadingOverlap(headingRange, overlapRanges));
- - - - -
- - - ]
158 [ + - - + : 1 : ASSERT_EQ(1u, overlapRanges.size());
- - - - -
- ]
159 [ + - + - : 1 : ASSERT_EQ(1. / 2. * physics::cPI, overlapRanges[0].begin);
- + - - -
- - - ]
160 [ + - - + : 1 : ASSERT_EQ(physics::cPI, overlapRanges[0].end);
- - - - -
- ]
161 : :
162 : : // headingRange intersects with outer, is lower
163 : 1 : overlapRanges.clear();
164 [ + - ]: 1 : headingRange.begin = 1. / 2. * physics::cPI;
165 [ + - ]: 1 : headingRange.end = 3. / 2. * physics::cPI;
166 : 1 : resultRange.begin = physics::cPI;
167 : 1 : resultRange.end = ad::physics::Angle(0.0);
168 [ + - ]: 1 : overlapRanges.push_back(resultRange);
169 [ + - - + : 1 : ASSERT_TRUE(ad::rss::unstructured::getHeadingOverlap(headingRange, overlapRanges));
- - - - -
- - - ]
170 [ + - - + : 1 : ASSERT_EQ(1u, overlapRanges.size());
- - - - -
- ]
171 [ + - - + : 1 : ASSERT_EQ(physics::cPI, overlapRanges[0].begin);
- - - - -
- ]
172 [ + - + - : 1 : ASSERT_EQ(3. / 2. * physics::cPI, overlapRanges[0].end);
- + - - -
- - - ]
173 : :
174 : : // headingRange does not intersect
175 : 1 : overlapRanges.clear();
176 : 1 : headingRange.begin = ad::physics::Angle(0.0);
177 [ + - ]: 1 : headingRange.end = 1. / 4. * physics::cPI;
178 [ + - ]: 1 : resultRange.begin = 5. / 8. * physics::cPI;
179 [ + - ]: 1 : resultRange.end = 7. / 8. * physics::cPI;
180 [ + - ]: 1 : overlapRanges.push_back(resultRange);
181 [ + - - + : 1 : ASSERT_FALSE(ad::rss::unstructured::getHeadingOverlap(headingRange, overlapRanges));
- - - - -
- - - ]
182 [ + - - + : 1 : ASSERT_EQ(0u, overlapRanges.size());
- - - - -
- ]
183 : :
184 : : // intersection, two ranges
185 : 1 : overlapRanges.clear();
186 : 1 : headingRange.begin = ad::physics::Angle(0.0);
187 : 1 : headingRange.end = physics::cPI;
188 [ + - ]: 1 : resultRange.begin = 3. / 4. * physics::cPI;
189 [ + - ]: 1 : resultRange.end = 1. / 4. * physics::cPI;
190 [ + - ]: 1 : overlapRanges.push_back(resultRange);
191 [ + - - + : 1 : ASSERT_TRUE(ad::rss::unstructured::getHeadingOverlap(headingRange, overlapRanges));
- - - - -
- - - ]
192 [ + - - + : 1 : ASSERT_EQ(2u, overlapRanges.size());
- - - - -
- ]
193 [ + - - + : 1 : ASSERT_EQ(ad::physics::Angle(0.0), overlapRanges[0].begin);
- - - - -
- ]
194 [ + - + - : 1 : ASSERT_EQ(1. / 4. * physics::cPI, overlapRanges[0].end);
- + - - -
- - - ]
195 [ + - + - : 1 : ASSERT_EQ(3. / 4. * physics::cPI, overlapRanges[1].begin);
- + - - -
- - - ]
196 [ + - - + : 1 : ASSERT_EQ(physics::cPI, overlapRanges[1].end);
- - - - -
- ]
197 : :
198 : : //-------------
199 : : // with innerRange
200 : : //-------------
201 : : // no intersection
202 : 1 : overlapRanges.clear();
203 [ + - ]: 1 : headingRange.begin = 3. / 4. * physics::cPI;
204 : 1 : headingRange.end = physics::cPI;
205 [ + - ]: 1 : resultRange.begin = 1. / 4. * physics::cPI;
206 [ + - ]: 1 : resultRange.end = 1. / 2. * physics::cPI;
207 [ + - ]: 1 : overlapRanges.push_back(resultRange);
208 [ + - ]: 1 : resultRange.begin = 3. / 2. * physics::cPI;
209 [ + - ]: 1 : resultRange.end = 7. / 4. * physics::cPI;
210 [ + - ]: 1 : overlapRanges.push_back(resultRange);
211 [ + - - + : 1 : ASSERT_FALSE(ad::rss::unstructured::getHeadingOverlap(headingRange, overlapRanges));
- - - - -
- - - ]
212 [ + - - + : 1 : ASSERT_EQ(0u, overlapRanges.size());
- - - - -
- ]
213 : :
214 : : // intersects, one resulting range (the lower one)
215 : 1 : overlapRanges.clear();
216 : 1 : headingRange.begin = ad::physics::Angle(0.0);
217 [ + - ]: 1 : headingRange.end = 1. / 4. * physics::cPI;
218 : 1 : resultRange.begin = ad::physics::Angle(0.0);
219 [ + - ]: 1 : resultRange.end = 1. / 4. * physics::cPI;
220 [ + - ]: 1 : overlapRanges.push_back(resultRange);
221 [ + - ]: 1 : resultRange.begin = 1. / 2. * physics::cPI;
222 : 1 : resultRange.end = physics::cPI;
223 [ + - ]: 1 : overlapRanges.push_back(resultRange);
224 [ + - - + : 1 : ASSERT_TRUE(ad::rss::unstructured::getHeadingOverlap(headingRange, overlapRanges));
- - - - -
- - - ]
225 [ + - - + : 1 : ASSERT_EQ(1u, overlapRanges.size());
- - - - -
- ]
226 [ + - - + : 1 : ASSERT_EQ(ad::physics::Angle(0.0), overlapRanges[0].begin);
- - - - -
- ]
227 [ + - + - : 1 : ASSERT_EQ(1. / 4. * physics::cPI, overlapRanges[0].end);
- + - - -
- - - ]
228 : :
229 : : // intersects, one resulting range (the upper one)
230 : 1 : overlapRanges.clear();
231 [ + - ]: 1 : headingRange.begin = 3. / 4. * physics::cPI;
232 [ + - ]: 1 : headingRange.end = 7. / 8. * physics::cPI;
233 : 1 : resultRange.begin = ad::physics::Angle(0.0);
234 [ + - ]: 1 : resultRange.end = 1. / 4. * physics::cPI;
235 [ + - ]: 1 : overlapRanges.push_back(resultRange);
236 [ + - ]: 1 : resultRange.begin = 1. / 2. * physics::cPI;
237 : 1 : resultRange.end = physics::cPI;
238 [ + - ]: 1 : overlapRanges.push_back(resultRange);
239 [ + - - + : 1 : ASSERT_TRUE(ad::rss::unstructured::getHeadingOverlap(headingRange, overlapRanges));
- - - - -
- - - ]
240 [ + - - + : 1 : ASSERT_EQ(1u, overlapRanges.size());
- - - - -
- ]
241 [ + - + - : 1 : ASSERT_EQ(3. / 4. * physics::cPI, overlapRanges[0].begin);
- + - - -
- - - ]
242 [ + - + - : 1 : ASSERT_EQ(7. / 8. * physics::cPI, overlapRanges[0].end);
- + - - -
- - - ]
243 : :
244 : : // intersects, two resulting range
245 : 1 : overlapRanges.clear();
246 [ + - ]: 1 : headingRange.begin = 1. / 4. * physics::cPI;
247 [ + - ]: 1 : headingRange.end = 3. / 4. * physics::cPI;
248 : 1 : resultRange.begin = ad::physics::Angle(0.0);
249 [ + - ]: 1 : resultRange.end = 1. / 2. * physics::cPI;
250 [ + - ]: 1 : overlapRanges.push_back(resultRange);
251 : 1 : resultRange.begin = physics::cPI;
252 [ + - ]: 1 : resultRange.end = 3. / 2. * physics::cPI;
253 [ + - ]: 1 : overlapRanges.push_back(resultRange);
254 [ + - - + : 1 : ASSERT_TRUE(ad::rss::unstructured::getHeadingOverlap(headingRange, overlapRanges));
- - - - -
- - - ]
255 [ + - - + : 1 : ASSERT_EQ(1u, overlapRanges.size());
- - - - -
- ]
256 [ + - + - : 1 : ASSERT_EQ(1. / 4. * physics::cPI, overlapRanges[0].begin);
- + - - -
- - - ]
257 [ + - + - : 1 : ASSERT_EQ(1. / 2. * physics::cPI, overlapRanges[0].end);
- + - - -
- - - ]
258 : :
259 : : // negative
260 : 1 : overlapRanges.clear();
261 [ + - ]: 1 : headingRange.begin = -1. / 2. * physics::cPI;
262 : 1 : headingRange.end = physics::cPI;
263 [ + - ]: 1 : resultRange.begin = -1. / 4. * physics::cPI;
264 [ + - ]: 1 : resultRange.end = 1. / 2. * physics::cPI;
265 [ + - ]: 1 : overlapRanges.push_back(resultRange);
266 [ + - - + : 1 : ASSERT_TRUE(ad::rss::unstructured::getHeadingOverlap(headingRange, overlapRanges));
- - - - -
- - - ]
267 [ + - - + : 1 : ASSERT_EQ(1u, overlapRanges.size());
- - - - -
- ]
268 [ + - + - : 1 : ASSERT_EQ(-1. / 4. * physics::cPI, overlapRanges[0].begin);
- + - - -
- - - ]
269 [ + - + - : 1 : ASSERT_EQ(1. / 2. * physics::cPI, overlapRanges[0].end);
- + - - -
- - - ]
270 : : }
271 : :
272 : 2 : TEST(GeometryTests, rotateAroundPoint)
273 : : {
274 [ + - + - : 1 : auto point = rotateAroundPoint(Point(1., 1.), Point(1., 0.), ad::physics::cPI);
+ - ]
275 [ + - + - : 1 : ASSERT_DOUBLE_EQ(0., point.x());
- + - - -
- - - ]
276 [ + - + - : 1 : ASSERT_DOUBLE_EQ(1., point.y());
- + - - -
- - - ]
277 : : }
278 : :
279 : 2 : TEST(GeometryTests, getPointOnCircle)
280 : : {
281 [ + - + - ]: 1 : auto point = getPointOnCircle(Point(1., 1.), ad::physics::Distance(2.), ad::physics::cPI_2);
282 [ + - + - : 1 : ASSERT_DOUBLE_EQ(1., point.x());
- + - - -
- - - ]
283 [ + - + - : 1 : ASSERT_DOUBLE_EQ(3., point.y());
- + - - -
- - - ]
284 : : }
285 : :
286 : 2 : TEST(GeometryTests, getCircleOrigin)
287 : : {
288 [ + - + - ]: 1 : auto point = getCircleOrigin(Point(2., 1.), ad::physics::Distance(2.), ad::physics::cPI_2);
289 [ + - + - : 1 : ASSERT_DOUBLE_EQ(2., point.x());
- + - - -
- - - ]
290 [ + - + - : 1 : ASSERT_DOUBLE_EQ(-1., point.y());
- + - - -
- - - ]
291 : : }
292 : :
293 : 2 : TEST(GeometryTests, calculateCircleArc)
294 : : {
295 [ + - ]: 1 : Polygon polygon;
296 [ + - + - ]: 1 : calculateCircleArc(Point(0., 0.),
297 : 1 : ad::physics::Distance(1.),
298 : 1 : ad::physics::Angle(0.0),
299 [ + - ]: 1 : 3. / 2. * ad::physics::cPI,
300 : : ad::physics::cPI_2,
301 : : polygon);
302 [ + - - + : 1 : ASSERT_EQ(4u, polygon.outer().size());
- - - - -
- ]
303 [ + - + - : 1 : ASSERT_NEAR(1., polygon.outer()[0].x(), epsilon);
- + - - -
- - - ]
304 [ + - + - : 1 : ASSERT_NEAR(0., polygon.outer()[0].y(), epsilon);
- + - - -
- - - ]
305 [ + - + - : 1 : ASSERT_NEAR(0., polygon.outer()[1].x(), epsilon);
- + - - -
- - - ]
306 [ + - + - : 1 : ASSERT_NEAR(1., polygon.outer()[1].y(), epsilon);
- + - - -
- - - ]
307 [ + - + - : 1 : ASSERT_NEAR(-1., polygon.outer()[2].x(), epsilon);
- + - - -
- - - ]
308 [ + - + - : 1 : ASSERT_NEAR(0., polygon.outer()[2].y(), epsilon);
- + - - -
- - - ]
309 [ + - + - : 1 : ASSERT_NEAR(0., polygon.outer()[3].x(), epsilon);
- + - - -
- - - ]
310 [ + - + - : 1 : ASSERT_NEAR(-1., polygon.outer()[3].y(), epsilon);
- + - - -
- - - ]
311 : : }
312 : :
313 : 2 : TEST(GeometryTests, collides)
314 : : {
315 : 1 : world::UnstructuredTrajectorySet set1;
316 [ + - + - : 1 : set1.push_back(toDistance(Point(0., 0.)));
+ - ]
317 [ + - + - : 1 : set1.push_back(toDistance(Point(0., 2.)));
+ - ]
318 [ + - + - : 1 : set1.push_back(toDistance(Point(2., 2.)));
+ - ]
319 [ + - + - : 1 : set1.push_back(toDistance(Point(2., 0.)));
+ - ]
320 : :
321 : 1 : world::UnstructuredTrajectorySet set2;
322 [ + - + - : 1 : set2.push_back(toDistance(Point(1., 1.)));
+ - ]
323 [ + - + - : 1 : set2.push_back(toDistance(Point(1., 3.)));
+ - ]
324 [ + - + - : 1 : set2.push_back(toDistance(Point(3., 3.)));
+ - ]
325 [ + - + - : 1 : set2.push_back(toDistance(Point(3., 1.)));
+ - ]
326 [ + - - + : 1 : ASSERT_TRUE(collides(set1, set2));
- - - - -
- - - ]
327 : :
328 : 1 : set2.clear();
329 [ + - + - : 1 : set2.push_back(toDistance(Point(3., 3.)));
+ - ]
330 [ + - + - : 1 : set2.push_back(toDistance(Point(3., 4.)));
+ - ]
331 [ + - + - : 1 : set2.push_back(toDistance(Point(4., 4.)));
+ - ]
332 [ + - + - : 1 : set2.push_back(toDistance(Point(4., 3.)));
+ - ]
333 [ + - - + : 1 : ASSERT_FALSE(collides(set1, set2));
- - - - -
- - - ]
334 : :
335 : 1 : set2.clear();
336 [ + - + - : 1 : set2.push_back(toDistance(Point(2., 2.)));
+ - ]
337 [ + - + - : 1 : set2.push_back(toDistance(Point(2., 3.)));
+ - ]
338 [ + - + - : 1 : set2.push_back(toDistance(Point(3., 3.)));
+ - ]
339 [ + - + - : 1 : set2.push_back(toDistance(Point(3., 2.)));
+ - ]
340 [ + - - + : 1 : ASSERT_TRUE(collides(set1, set2));
- - - - -
- - - ]
341 : : }
342 : :
343 : : } // namespace unstructured
344 : : } // namespace rss
345 : : } // namespace ad
|