Branch data Line data Source code
1 : : // ----------------- BEGIN LICENSE BLOCK ---------------------------------
2 : : //
3 : : // Copyright (C) 2018-2021 Intel Corporation
4 : : //
5 : : // SPDX-License-Identifier: MIT
6 : : //
7 : : // ----------------- END LICENSE BLOCK -----------------------------------
8 : : /**
9 : : * @file
10 : : */
11 : :
12 : : #pragma once
13 : :
14 : : #include "ad/map/access/Types.hpp"
15 : : #include "ad/map/lane/Types.hpp"
16 : : #include "ad/map/route/Types.hpp"
17 : :
18 : : /** @brief namespace ad */
19 : : namespace ad {
20 : : /** @brief namespace map */
21 : : namespace map {
22 : : /** @brief namespace route */
23 : : namespace route {
24 : :
25 : : /**
26 : : * @brief class defining a route interval with one lane
27 : : *
28 : : * The route interval consists of the id of the lane, the start and end point of lane on the route as TParam.
29 : : * TParam describes a parametric point along the lane geometry. By defining the start and end of the route interval,
30 : : * also a direction of the route is defined ... at least if @c start and @c end points differ from each other.
31 : : *
32 : : * If start == end, the route interval is degenerated and therefore no meaningful route direction can be derived.
33 : : * Only if start != end, checks like isAfterInterval(), isBeforeInterval(),
34 : : * isRouteDirectionPositive(), isRouteDirectionNegative() provide the expected information.
35 : : */
36 : :
37 : : /**
38 : : * @brief get interval start as ParaPoint
39 : : */
40 : 1223 : inline point::ParaPoint getIntervalStart(LaneInterval const &laneInterval)
41 : : {
42 [ # # ]: 1223 : point::ParaPoint result;
43 : 1223 : result.laneId = laneInterval.laneId;
44 : 1223 : result.parametricOffset = laneInterval.start;
45 : 1223 : return result;
46 : : }
47 : :
48 : : /**
49 : : * @brief get interval start as ParaPoint for a given laneId and a given route
50 : : *
51 : : * throws if laneId not found in route
52 : : */
53 : : point::ParaPoint getIntervalStart(FullRoute const &route, lane::LaneId const &laneId);
54 : :
55 : : /**
56 : : * @brief get interval end as ParaPoint
57 : : */
58 : 1304 : inline point::ParaPoint getIntervalEnd(LaneInterval const &laneInterval)
59 : : {
60 [ # # ]: 1304 : point::ParaPoint result;
61 : 1304 : result.laneId = laneInterval.laneId;
62 : 1304 : result.parametricOffset = laneInterval.end;
63 : 1304 : return result;
64 : : }
65 : :
66 : : /**
67 : : * @brief convert lane interval to ParametricRange
68 : : */
69 : 1436 : inline physics::ParametricRange toParametricRange(route::LaneInterval const &laneInterval)
70 : : {
71 [ + - ]: 1436 : physics::ParametricRange range;
72 [ + - + + ]: 1436 : if (laneInterval.start <= laneInterval.end)
73 : : {
74 : 1415 : range.minimum = laneInterval.start;
75 : 1415 : range.maximum = laneInterval.end;
76 : : }
77 : : else
78 : : {
79 : 21 : range.minimum = laneInterval.end;
80 : 21 : range.maximum = laneInterval.start;
81 : : }
82 : 1436 : return range;
83 : : }
84 : :
85 : : /**
86 : : * @brief get the signed parametric physics::Distance between two parametric points respecting the laneInterval's
87 : : * direction
88 : : *
89 : : * @retval > 0, if the \c first point is before the \c second point within the interval
90 : : * @retval < 0, if the \c second point is before the \c first point within the interval
91 : : * @retval = 0, if both are equal
92 : : *
93 : : * @throws std::invalid_argument if the parametric points are not referring to the landId
94 : : */
95 : : physics::ParametricValue
96 : : getSignedDistance(LaneInterval const &laneInterval, point::ParaPoint const &first, point::ParaPoint const &second);
97 : :
98 : : /**
99 : : * @brief get the unsigned parametric physics::Distance between two parametric points
100 : : *
101 : : * @retval | \c first.parametricOffset - \c second.parametricOffset |
102 : : * @throws std::invalid_argument if the parametric points are not referring to the landId
103 : : */
104 : : physics::ParametricValue
105 : : getUnsignedDistance(LaneInterval const &laneInterval, point::ParaPoint const &first, point::ParaPoint const &second);
106 : :
107 : : /**
108 : : * @brief checks if the point marks the start of the interval
109 : : *
110 : : * @param[in] point parametric point to be checked against the route interval start
111 : : *
112 : : * @returns @c true if LaneId and TParam at start of this matches the given @c point
113 : : */
114 : : inline bool isStartOfInterval(LaneInterval const &laneInterval, point::ParaPoint const &point)
115 : : {
116 : : return (point.laneId == laneInterval.laneId) && (point.parametricOffset == laneInterval.start);
117 : : }
118 : :
119 : : /**
120 : : * @brief checks if the point marks the end of the interval
121 : : *
122 : : * @param[in] point parametric point to be checked against the route interval end
123 : : *
124 : : * @returns @c true if LaneId and TParam at end of this matches the given @c point
125 : : */
126 : : inline bool isEndOfInterval(LaneInterval const &laneInterval, point::ParaPoint const &point)
127 : : {
128 : : return (point.laneId == laneInterval.laneId) && (point.parametricOffset == laneInterval.end);
129 : : }
130 : :
131 : : /**
132 : : * @brief checks if the direction of this route interval is positive in respect to the lane geometry
133 : : *
134 : : * @returns @c true if the parametric points follow: start < end
135 : : * @returns @c lane::isLaneDirectionPositive(laneInterval.laneId) ^ wrongWay if start == end (degenerated interval uses
136 : : * wrong way flag to determine
137 : : * the route direction)
138 : : */
139 : : bool isRouteDirectionPositive(LaneInterval const &laneInterval);
140 : :
141 : : /**
142 : : * @brief checks if the direction of this route interval is negative in respect to the lane geometry
143 : : *
144 : : * @returns !isRouteDirectionPositive()
145 : : */
146 : 12 : inline bool isRouteDirectionNegative(LaneInterval const &laneInterval)
147 : : {
148 : 12 : return !isRouteDirectionPositive(laneInterval);
149 : : }
150 : :
151 : : /**
152 : : * @brief checks if the route direction is aligned with the nominal driving direction of the lane
153 : : */
154 : : bool isRouteDirectionAlignedWithDrivingDirection(LaneInterval const &laneInterval);
155 : :
156 : : /**
157 : : * @brief checks if the parametric offset is within the interval
158 : : *
159 : : * @param[in] parametricOffset parametric offset to be checked against the route interval
160 : : *
161 : : * @returns @c true if parametric offset is within the interval
162 : : */
163 : 132 : inline bool isWithinInterval(LaneInterval const &laneInterval, physics::ParametricValue const ¶metricOffset)
164 : : {
165 [ + + ]: 132 : if (isRouteDirectionPositive(laneInterval))
166 : : {
167 [ + + + + ]: 84 : return (laneInterval.start <= parametricOffset) && (parametricOffset <= laneInterval.end);
168 : : }
169 : : else
170 : : {
171 [ + + + + ]: 48 : return (laneInterval.end <= parametricOffset) && (parametricOffset <= laneInterval.start);
172 : : }
173 : : }
174 : :
175 : : /**
176 : : * @brief checks if the point is within the interval
177 : : *
178 : : * @param[in] point parametric point to be checked against the route interval
179 : : *
180 : : * @returns @c true if LaneId matches and TParam of the given @c point is within the interval
181 : : */
182 : 72 : inline bool isWithinInterval(LaneInterval const &laneInterval, point::ParaPoint const &point)
183 : : {
184 [ + - + + ]: 72 : return (point.laneId == laneInterval.laneId) && isWithinInterval(laneInterval, point.parametricOffset);
185 : : }
186 : :
187 : : /**
188 : : * @brief checks if the interval is degenerated
189 : : *
190 : : * The interval is degenerated if start and end of the interval are equal.
191 : : * In such a case no meaningful information on route direction is possible.
192 : : *
193 : : * @returns @c true if the interval is degenerated: start == end
194 : : */
195 : 1577 : inline bool isDegenerated(LaneInterval const &laneInterval)
196 : : {
197 : 1577 : return (laneInterval.start == laneInterval.end);
198 : : }
199 : :
200 : : /**
201 : : * @brief checks if the parametric offset is after the interval
202 : : *
203 : : * @param[in] parametricOffset parametric offset to be checked against the route interval
204 : : *
205 : : * @returns @c true if given parametric offset is after the interval
206 : : * Be aware: if the route interval is degenerated isAfterInterval() and isBeforeInterval() return the same value
207 : : */
208 : 868 : inline bool isAfterInterval(LaneInterval const &laneInterval, physics::ParametricValue const parametricOffset)
209 : : {
210 [ + + ]: 868 : if (isRouteDirectionPositive(laneInterval))
211 : : {
212 : 419 : return (parametricOffset > laneInterval.end);
213 : : }
214 : : else
215 : : {
216 : 449 : return (parametricOffset < laneInterval.end);
217 : : }
218 : : }
219 : :
220 : : /**
221 : : * @brief checks if the point is after the interval
222 : : *
223 : : * @param[in] point parametric point to be checked against the route interval
224 : : *
225 : : * @returns @c true if LaneId matches and TParam of the given @c point is after the interval
226 : : * Be aware: if the route interval is degenerated isAfterInterval() and isBeforeInterval() return the same value
227 : : * ( point != end )
228 : : */
229 : 2 : inline bool isAfterInterval(LaneInterval const &laneInterval, point::ParaPoint const &point)
230 : : {
231 [ + + ]: 2 : if (point.laneId == laneInterval.laneId)
232 : : {
233 : 1 : return isAfterInterval(laneInterval, point.parametricOffset);
234 : : }
235 : 1 : return false;
236 : : }
237 : :
238 : : /**
239 : : * @brief checks if the parametric offset is before the interval
240 : : *
241 : : * @param[in] parametricOffset parametric offset to be checked against the route interval
242 : : *
243 : : * @returns @c true if parametric offset is before the interval
244 : : * Be aware: if the route interval is degenerated isAfterInterval() and isBeforeInterval() return the same value
245 : : */
246 : 460 : inline bool isBeforeInterval(LaneInterval const &laneInterval, physics::ParametricValue const parametricOffset)
247 : : {
248 [ + + ]: 460 : if (isRouteDirectionPositive(laneInterval))
249 : : {
250 : 254 : return (parametricOffset < laneInterval.start);
251 : : }
252 : : else
253 : : {
254 : 206 : return (parametricOffset > laneInterval.start);
255 : : }
256 : : }
257 : :
258 : : /**
259 : : * @brief checks if the point is before the interval
260 : : *
261 : : * @param[in] point parametric point to be checked against the route interval
262 : : *
263 : : * @returns @c true if LaneId matches and TParam of the given @c point is before the interval
264 : : * Be aware: if the route interval is degenerated isAfterInterval() and isBeforeInterval() return the same value
265 : : * ( point != start )
266 : : */
267 : 6 : inline bool isBeforeInterval(LaneInterval const &laneInterval, point::ParaPoint const &point)
268 : : {
269 [ + + ]: 6 : if (point.laneId == laneInterval.laneId)
270 : : {
271 : 5 : return isBeforeInterval(laneInterval, point.parametricOffset);
272 : : }
273 : 1 : return false;
274 : : }
275 : :
276 : : /**
277 : : * @brief checks if the range overlaps with the interval
278 : : *
279 : : * @param[in] range parametric range to be checked against the route interval
280 : : *
281 : : * @returns @c true if range overlaps with the interval
282 : : */
283 : : inline bool overlapsInterval(LaneInterval const &laneInterval, physics::ParametricRange const &range)
284 : : {
285 : : bool rangeIsOutside = (isBeforeInterval(laneInterval, range.minimum) && isBeforeInterval(laneInterval, range.maximum))
286 : : || (isAfterInterval(laneInterval, range.minimum) && isAfterInterval(laneInterval, range.maximum));
287 : : return !rangeIsOutside;
288 : : }
289 : :
290 : : /**
291 : : * @brief project a given parametric position (offset) to the center line of the given
292 : : * neighbor lane
293 : : *
294 : : * @param[in] currentInterval is the current lane
295 : : * @param[in] neighborInterval is the neighbor lane
296 : : * @param[in] parametricOffset is the current position that should be projected to the neighbor lane
297 : : *
298 : : * Note: If the given neighborInterval is not a neighbor of the currentInterval the function will throw
299 : : *
300 : : * @return Projected position as parametric offset
301 : : */
302 : : physics::ParametricValue getProjectedParametricOffsetOnNeighborLane(LaneInterval const ¤tInterval,
303 : : LaneInterval const &neighborInterval,
304 : : physics::ParametricValue const ¶metricOffset);
305 : :
306 : : /**
307 : : * @brief calculate the length of the provided lane interval as parametric value
308 : : */
309 : 236 : inline physics::ParametricValue calcParametricLength(LaneInterval const &laneInterval)
310 : : {
311 : 236 : return std::fabs(laneInterval.start - laneInterval.end);
312 : : }
313 : :
314 : : /** @brief calculate the length of the provided lane interval as physics::Distance value
315 : : *
316 : : * For length calculation the parametric length of the interval (calcParametricLength())
317 : : * is multiplied by the lane's length.
318 : : */
319 : : physics::Distance calcLength(LaneInterval const &laneInterval);
320 : :
321 : : /** @brief calculate the Duration of the provided lane interval as duration value
322 : : *
323 : : * For Duration calculations maximum allowed speed combined with the length is taken into account
324 : : */
325 : : physics::Duration calcDuration(LaneInterval const &laneInterval);
326 : :
327 : : /**
328 : : * @brief get right edge of the lane interval as ENUEdge
329 : : *
330 : : * Be aware: Right is in the sense of the lane interval orientation.
331 : : * If the lane interval has negative direction the physical left edge of the underlying lane is returned.
332 : : * Furthermore, the points are ordered in the logical lane interval direction:
333 : : * the first point is at lane interval start and the last one at lane interval end.
334 : : */
335 : : void getRightEdge(LaneInterval const &laneInterval, point::ENUEdge &enuEdge);
336 : :
337 : : /**
338 : : * @brief get right edge of the lane interval as ECEFEdge
339 : : *
340 : : * Be aware: Right is in the sense of the lane interval orientation.
341 : : * If the lane interval has negative direction the physical left edge of the underlying lane is returned.
342 : : * Furthermore, the points are ordered in the logical lane interval direction:
343 : : * the first point is at lane interval start and the last one at lane interval end.
344 : : */
345 : : void getRightEdge(LaneInterval const &laneInterval, point::ECEFEdge &ecefEdge);
346 : :
347 : : /**
348 : : * @brief get right edge of the lane interval as GeoEdge
349 : : *
350 : : * Be aware: Right is in the sense of the lane interval orientation.
351 : : * If the lane interval has negative direction the physical left edge of the underlying lane is returned.
352 : : * Furthermore, the points are ordered in the logical lane interval direction:
353 : : * the first point is at lane interval start and the last one at lane interval end.
354 : : */
355 : : void getRightEdge(LaneInterval const &laneInterval, point::GeoEdge &geoEdge);
356 : :
357 : : /**
358 : : * @brief get right edge of the lane interval as ENUEdge
359 : : *
360 : : * Be aware: Right is in the sense of the lane interval orientation.
361 : : * If the lane interval has negative direction the physical left edge of the underlying lane is returned.
362 : : * Furthermore, the points are ordered in the logical lane interval direction:
363 : : * the first point is at lane interval start and the last one at lane interval end.
364 : : */
365 : : point::ENUEdge getRightENUEdge(LaneInterval const &laneInterval);
366 : :
367 : : /**
368 : : * @brief get right edge of the lane interval as ECEFEdge
369 : : *
370 : : * Be aware: Right is in the sense of the lane interval orientation.
371 : : * If the lane interval has negative direction the physical left edge of the underlying lane is returned.
372 : : * Furthermore, the points are ordered in the logical lane interval direction:
373 : : * the first point is at lane interval start and the last one at lane interval end.
374 : : */
375 : : point::ECEFEdge getRightECEFEdge(LaneInterval const &laneInterval);
376 : :
377 : : /**
378 : : * @brief get right edge of the lane interval as GeoEdge
379 : : *
380 : : * Be aware: Right is in the sense of the lane interval orientation.
381 : : * If the lane interval has negative direction the physical left edge of the underlying lane is returned.
382 : : * Furthermore, the points are ordered in the logical lane interval direction:
383 : : * the first point is at lane interval start and the last one at lane interval end.
384 : : */
385 : : point::GeoEdge getRightGeoEdge(LaneInterval const &laneInterval);
386 : :
387 : : /**
388 : : * @brief get right edge of the lane interval as ENUEdge using projection to find the start of the edge
389 : : *
390 : : * Be aware: Right is in the sense of the lane interval orientation.
391 : : * If the lane interval has negative direction the physical left edge of the underlying lane is returned.
392 : : * Furthermore, the points are ordered in the logical lane interval direction:
393 : : * the first point is at lane interval start and the last one at lane interval end.
394 : : */
395 : : void getRightProjectedEdge(LaneInterval const &laneInterval, point::ENUEdge &enuEdge);
396 : :
397 : : /**
398 : : * @brief get right edge of the lane interval as ECEFEdge using projection to find the start of the edge
399 : : *
400 : : * Be aware: Right is in the sense of the lane interval orientation.
401 : : * If the lane interval has negative direction the physical left edge of the underlying lane is returned.
402 : : * Furthermore, the points are ordered in the logical lane interval direction:
403 : : * the first point is at lane interval start and the last one at lane interval end.
404 : : */
405 : : void getRightProjectedEdge(LaneInterval const &laneInterval, point::ECEFEdge &ecefEdge);
406 : :
407 : : /**
408 : : * @brief get right edge of the lane interval as GeoEdge using projection to find the start of the edge
409 : : *
410 : : * Be aware: Right is in the sense of the lane interval orientation.
411 : : * If the lane interval has negative direction the physical left edge of the underlying lane is returned.
412 : : * Furthermore, the points are ordered in the logical lane interval direction:
413 : : * the first point is at lane interval start and the last one at lane interval end.
414 : : */
415 : : void getRightProjectedEdge(LaneInterval const &laneInterval, point::GeoEdge &geoEdge);
416 : :
417 : : /**
418 : : * @brief get right edge of the lane interval as ENUEdge using projection to find the start of the edge
419 : : *
420 : : * Be aware: Right is in the sense of the lane interval orientation.
421 : : * If the lane interval has negative direction the physical left edge of the underlying lane is returned.
422 : : * Furthermore, the points are ordered in the logical lane interval direction:
423 : : * the first point is at lane interval start and the last one at lane interval end.
424 : : */
425 : : point::ENUEdge getRightProjectedENUEdge(LaneInterval const &laneInterval);
426 : :
427 : : /**
428 : : * @brief get right edge of the lane interval as ECEFEdge using projection to find the start of the edge
429 : : *
430 : : * Be aware: Right is in the sense of the lane interval orientation.
431 : : * If the lane interval has negative direction the physical left edge of the underlying lane is returned.
432 : : * Furthermore, the points are ordered in the logical lane interval direction:
433 : : * the first point is at lane interval start and the last one at lane interval end.
434 : : */
435 : : point::ECEFEdge getRightProjectedECEFEdge(LaneInterval const &laneInterval);
436 : :
437 : : /**
438 : : * @brief get right edge of the lane interval as GeoEdge using projection to find the start of the edge
439 : : *
440 : : * Be aware: Right is in the sense of the lane interval orientation.
441 : : * If the lane interval has negative direction the physical left edge of the underlying lane is returned.
442 : : * Furthermore, the points are ordered in the logical lane interval direction:
443 : : * the first point is at lane interval start and the last one at lane interval end.
444 : : */
445 : : point::GeoEdge getRightProjectedGeoEdge(LaneInterval const &laneInterval);
446 : :
447 : : /**
448 : : * @brief get Left edge of the lane interval as ENUEdge
449 : : *
450 : : * Be aware: Left is in the sense of the lane interval orientation.
451 : : * If the lane interval has negative direction the physical right edge of the underlying lane is returned.
452 : : * Furthermore, the points are ordered in the logical lane interval direction:
453 : : * the first point is at lane interval start and the last one at lane interval end.
454 : : */
455 : : void getLeftEdge(LaneInterval const &laneInterval, point::ENUEdge &enuEdge);
456 : :
457 : : /**
458 : : * @brief get Left edge of the lane interval as ECEFEdge
459 : : *
460 : : * Be aware: Left is in the sense of the lane interval orientation.
461 : : * If the lane interval has negative direction the physical right edge of the underlying lane is returned.
462 : : * Furthermore, the points are ordered in the logical lane interval direction:
463 : : * the first point is at lane interval start and the last one at lane interval end.
464 : : */
465 : : void getLeftEdge(LaneInterval const &laneInterval, point::ECEFEdge &ecefEdge);
466 : :
467 : : /**
468 : : * @brief get Left edge of the lane interval as GeoEdge
469 : : *
470 : : * Be aware: Left is in the sense of the lane interval orientation.
471 : : * If the lane interval has negative direction the physical right edge of the underlying lane is returned.
472 : : * Furthermore, the points are ordered in the logical lane interval direction:
473 : : * the first point is at lane interval start and the last one at lane interval end.
474 : : */
475 : : void getLeftEdge(LaneInterval const &laneInterval, point::GeoEdge &geoEdge);
476 : :
477 : : /**
478 : : * @brief get left edge of the lane interval as ENUEdge
479 : : *
480 : : * Be aware: Left is in the sense of the lane interval orientation.
481 : : * If the lane interval has negative direction the physical right edge of the underlying lane is returned.
482 : : * Furthermore, the points are ordered in the logical lane interval direction:
483 : : * the first point is at lane interval start and the last one at lane interval end.
484 : : */
485 : : point::ENUEdge getLeftENUEdge(LaneInterval const &laneInterval);
486 : :
487 : : /**
488 : : * @brief get left edge of the lane interval as ECEFEdge
489 : : *
490 : : * Be aware: Left is in the sense of the lane interval orientation.
491 : : * If the lane interval has negative direction the physical right edge of the underlying lane is returned.
492 : : * Furthermore, the points are ordered in the logical lane interval direction:
493 : : * the first point is at lane interval start and the last one at lane interval end.
494 : : */
495 : : point::ECEFEdge getLeftECEFEdge(LaneInterval const &laneInterval);
496 : :
497 : : /**
498 : : * @brief get left edge of the lane interval as GeoEdge
499 : : *
500 : : * Be aware: Left is in the sense of the lane interval orientation.
501 : : * If the lane interval has negative direction the physical right edge of the underlying lane is returned.
502 : : * Furthermore, the points are ordered in the logical lane interval direction:
503 : : * the first point is at lane interval start and the last one at lane interval end.
504 : : */
505 : : point::GeoEdge getLeftGeoEdge(LaneInterval const &laneInterval);
506 : :
507 : : /**
508 : : * @brief get Left edge of the lane interval as ENUEdge using projection to find the start of the edge
509 : : *
510 : : * Be aware: Left is in the sense of the lane interval orientation.
511 : : * If the lane interval has negative direction the physical right edge of the underlying lane is returned.
512 : : * Furthermore, the points are ordered in the logical lane interval direction:
513 : : * the first point is at lane interval start and the last one at lane interval end.
514 : : */
515 : : void getLeftProjectedEdge(LaneInterval const &laneInterval, point::ENUEdge &enuEdge);
516 : :
517 : : /**
518 : : * @brief get Left edge of the lane interval as ECEFEdge using projection to find the start of the edge
519 : : *
520 : : * Be aware: Left is in the sense of the lane interval orientation.
521 : : * If the lane interval has negative direction the physical right edge of the underlying lane is returned.
522 : : * Furthermore, the points are ordered in the logical lane interval direction:
523 : : * the first point is at lane interval start and the last one at lane interval end.
524 : : */
525 : : void getLeftProjectedEdge(LaneInterval const &laneInterval, point::ECEFEdge &ecefEdge);
526 : :
527 : : /**
528 : : * @brief get Left edge of the lane interval as GeoEdge using projection to find the start of the edge
529 : : *
530 : : * Be aware: Left is in the sense of the lane interval orientation.
531 : : * If the lane interval has negative direction the physical right edge of the underlying lane is returned.
532 : : * Furthermore, the points are ordered in the logical lane interval direction:
533 : : * the first point is at lane interval start and the last one at lane interval end.
534 : : */
535 : : void getLeftProjectedEdge(LaneInterval const &laneInterval, point::GeoEdge &geoEdge);
536 : :
537 : : /**
538 : : * @brief get left edge of the lane interval as ENUEdge using projection to find the start of the edge
539 : : *
540 : : * Be aware: Left is in the sense of the lane interval orientation.
541 : : * If the lane interval has negative direction the physical right edge of the underlying lane is returned.
542 : : * Furthermore, the points are ordered in the logical lane interval direction:
543 : : * the first point is at lane interval start and the last one at lane interval end.
544 : : */
545 : : point::ENUEdge getLeftProjectedENUEdge(LaneInterval const &laneInterval);
546 : :
547 : : /**
548 : : * @brief get left edge of the lane interval as ECEFEdge using projection to find the start of the edge
549 : : *
550 : : * Be aware: Left is in the sense of the lane interval orientation.
551 : : * If the lane interval has negative direction the physical right edge of the underlying lane is returned.
552 : : * Furthermore, the points are ordered in the logical lane interval direction:
553 : : * the first point is at lane interval start and the last one at lane interval end.
554 : : */
555 : : point::ECEFEdge getLeftProjectedECEFEdge(LaneInterval const &laneInterval);
556 : :
557 : : /**
558 : : * @brief get left edge of the lane interval as GeoEdge using projection to find the start of the edge
559 : : *
560 : : * Be aware: Left is in the sense of the lane interval orientation.
561 : : * If the lane interval has negative direction the physical right edge of the underlying lane is returned.
562 : : * Furthermore, the points are ordered in the logical lane interval direction:
563 : : * the first point is at lane interval start and the last one at lane interval end.
564 : : */
565 : : point::GeoEdge getLeftProjectedGeoEdge(LaneInterval const &laneInterval);
566 : :
567 : : /**
568 : : * @brief get the geo borders of this lane
569 : : */
570 : : lane::GeoBorder getGeoBorder(LaneInterval const &laneInterval);
571 : :
572 : : /**
573 : : * @brief get the ecef borders of this lane
574 : : */
575 : : lane::ECEFBorder getECEFBorder(LaneInterval const &laneInterval);
576 : :
577 : : /**
578 : : * @brief get the enu borders of this lane
579 : : *
580 : : * Note: The border (left/right edge) will start with the parametric offset
581 : : * given by the laneInterval.
582 : : */
583 : : lane::ENUBorder getENUBorder(LaneInterval const &laneInterval);
584 : :
585 : : /**
586 : : * @brief get the enu borders of this lane
587 : : *
588 : : * Note: The border (left/right edge) does not necessarily start/end with the
589 : : * parametric offset given by the laneInterval. Instead this offset is used
590 : : * for the center line and the resulting point is orthogonally projected on
591 : : * the edges to obtain the border
592 : : */
593 : : lane::ENUBorder getENUProjectedBorder(LaneInterval const &laneInterval);
594 : :
595 : : /**
596 : : * @brief shorten the LaneInterval about a given physics::Distance.
597 : : * Will remove at the begin of the LaneInterval
598 : : *
599 : : * @param[in] the LaneInterval that should be shortened
600 : : * @param[in] physics::Distance the LaneInterval should be shortened
601 : : *
602 : : * @returns resulting shortened LaneInterval
603 : : *
604 : : * If physics::Distance is bigger then the length of the interval. Resulting length will be zero. LaneInterval.start =
605 : : * LaneInterval.end
606 : : */
607 : : LaneInterval shortenIntervalFromBegin(LaneInterval const &laneInterval, physics::Distance const &distance);
608 : :
609 : : /**
610 : : * @brief shorten the LaneInterval about a given physics::Distance.
611 : : * Will remove at the end of the LaneInterval
612 : : *
613 : : * @param[in] laneInterval the LaneInterval that should be shortened
614 : : * @param[in] physics::Distance the LaneInterval should be shortened
615 : : *
616 : : * @returns resulting shortened LaneInterval
617 : : *
618 : : * If physics::Distance is bigger then the length of the interval. Resulting length will be zero. LaneInterval.end =
619 : : * LaneInterval.start
620 : : */
621 : : LaneInterval shortenIntervalFromEnd(LaneInterval const &laneInterval, physics::Distance const &distance);
622 : :
623 : : /**
624 : : * @brief Restrict length of the LaneInterval to a given physics::Distance from start.
625 : : *
626 : : * @param[in] laneInterval the LaneInterval that should be restricted
627 : : * @param[in] physics::Distance the LaneInterval should be restricted to
628 : : *
629 : : * @returns resulting shortened LaneInterval
630 : : *
631 : : * If physics::Distance is bigger then the length of the interval. Resulting LaneInterval is the input Interval.
632 : : */
633 : : LaneInterval restrictIntervalFromBegin(LaneInterval const &laneInterval, physics::Distance const &distance);
634 : :
635 : : /**
636 : : * @brief extend the lane interval until the end of the lane reached
637 : : *
638 : : * The end is set to the lane's maximal value (depending on the route direction to 0. or 1.).
639 : : * If the lane interval is degenerated nothing is done.
640 : : *
641 : : * @param[in] laneInterval the LaneInterval that should be extended
642 : : *
643 : : * @returns resulting extended LaneInterval
644 : : */
645 : : LaneInterval extendIntervalUntilEnd(LaneInterval const &laneInterval);
646 : :
647 : : /**
648 : : * @brief cut the LaneInterval at a given parametric point.
649 : : * Will remove at the start of the LaneInterval
650 : : *
651 : : * @param[in] the LaneInterval that should be shortened
652 : : * @param[in] newIntervalStart the new start of the interval if the point is within the LaneInterval
653 : : *
654 : : * @returns resulting shortened LaneInterval
655 : : *
656 : : * If the parametric offset is outside of the interval, the original lane interval is returned.
657 : : */
658 : : LaneInterval cutIntervalAtStart(LaneInterval const &laneInterval, physics::ParametricValue const &newIntervalStart);
659 : :
660 : : /**
661 : : * @brief extend the lane interval until the start of the lane reached
662 : : *
663 : : * The start is set to the lane's minimal value (depending on the route direction to 1. or 0.).
664 : : * If the lane interval is degenerated nothing is done.
665 : : *
666 : : * @param[in] laneInterval the LaneInterval that should be extended
667 : : *
668 : : * @returns resulting extended LaneInterval
669 : : */
670 : : LaneInterval extendIntervalUntilStart(LaneInterval const &laneInterval);
671 : :
672 : : /**
673 : : * @brief extend the lane interval by moving its start position by physics::Distance
674 : : *
675 : : * If the lane interval is degenerated nothing is done.
676 : : *
677 : : * @param[in] laneInterval the LaneInterval that should be extended
678 : : * @param[in] physics::Distance by which the LaneInterval should be extended
679 : : *
680 : : * @returns resulting extended LaneInterval
681 : : */
682 : : LaneInterval extendIntervalFromStart(LaneInterval const &laneInterval, physics::Distance const &distance);
683 : :
684 : : /**
685 : : * @brief extend the lane interval by moving its end position by physics::Distance
686 : : *
687 : : * If the lane interval is degenerated nothing is done.
688 : : *
689 : : * @param[in] laneInterval the LaneInterval that should be extended
690 : : * @param[in] physics::Distance by which the LaneInterval should be extended
691 : : *
692 : : * @returns resulting extended LaneInterval
693 : : */
694 : : LaneInterval extendIntervalFromEnd(LaneInterval const &laneInterval, physics::Distance const &distance);
695 : :
696 : : /**
697 : : * @brief cut the LaneInterval at a given parametric point.
698 : : * Will remove at the end of the LaneInterval
699 : : *
700 : : * @param[in] the LaneInterval that should be shortened
701 : : * @param[in] newIntervalEnd the new end of the interval if the point is within the LaneInterval
702 : : *
703 : : * @returns resulting shortened LaneInterval
704 : : *
705 : : * If the parametric offset is outside of the interval, the original lane interval is returned.
706 : : */
707 : : LaneInterval cutIntervalAtEnd(LaneInterval const &laneInterval, physics::ParametricValue const &newIntervalEnd);
708 : :
709 : : /**
710 : : * @brief get the speed limits of the lane interval
711 : : */
712 : : restriction::SpeedLimitList getSpeedLimits(LaneInterval const &laneInterval);
713 : :
714 : : /**
715 : : * @brief get the metric ranges of the lane interval
716 : : */
717 : : void getMetricRanges(LaneInterval const &laneInterval,
718 : : physics::MetricRange &lengthRange,
719 : : physics::MetricRange &widthRange);
720 : :
721 : : } // namespace route
722 : : } // namespace map
723 : : } // namespace ad
|