pub struct LaneBoundary<'a> { /* private fields */ }Expand description
Represents a boundary between adjacent lanes or at the edge of a Segment.
A LaneBoundary is owned by a Segment and serves as the interface between two adjacent lanes, or between a lane and the segment edge. For a Segment with N lanes, there are N+1 boundaries:
+r direction
<─────────────
Boundary N ... Boundary 2 Boundary 1 Boundary 0
| | | |
| Lane N-1 | ... | Lane 1 | Lane 0 |
| | | |
(left edge) (right edge)Where:
- Boundary 0 is the right edge (minimum r coordinate).
- Boundary N is the left edge (maximum r coordinate).
- Boundaries are indexed with increasing r direction.
Each LaneBoundary provides:
- Reference to the lane on its left (if any).
- Reference to the lane on its right (if any).
- Query methods for lane markings at specific s-coordinates.
The design ensures that adjacent lanes share the same boundary object, avoiding redundancy and ensuring consistency. For example, Lane 1’s right boundary is the same object as Lane 0’s left boundary (Boundary 1).
Implementations§
Source§impl<'a> LaneBoundary<'a>
impl<'a> LaneBoundary<'a>
Sourcepub fn id(&self) -> String
pub fn id(&self) -> String
Returns the ID of the LaneBoundary. The ID is a unique identifier for the LaneBoundary within the Segment.
§Returns
A String containing the ID of the LaneBoundary.
Sourcepub fn segment(&self) -> Option<Segment<'a>>
pub fn segment(&self) -> Option<Segment<'a>>
Returns the segment that contains this LaneBoundary.
§Returns
An Option<Segment> containing a reference to the Segment if it exists,
or None if the LaneBoundary is not associated with a segment.
Sourcepub fn index(&self) -> i32
pub fn index(&self) -> i32
Returns the index of this boundary within the parent Segment.
Boundaries are indexed from 0 (rightmost, minimum r) to num_lanes() (leftmost, maximum r).
Sourcepub fn lane_to_left(&self) -> Option<Lane<'a>>
pub fn lane_to_left(&self) -> Option<Lane<'a>>
Sourcepub fn lane_to_right(&self) -> Option<Lane<'a>>
pub fn lane_to_right(&self) -> Option<Lane<'a>>
Sourcepub fn get_marking(&self, s: f64) -> Option<LaneMarkingQuery>
pub fn get_marking(&self, s: f64) -> Option<LaneMarkingQuery>
Gets the lane marking at a specific s-coordinate along this boundary.
§Arguments
s- The s-coordinate along the boundary (in the lane coordinate system). Typically in the range [0, segment_length].
§Returns
A LaneMarkingQuery at the specified position, including the marking details and the
s-range over which it is valid, or None if no marking information is available at that location.
Sourcepub fn get_markings(&self) -> Vec<LaneMarkingQuery>
pub fn get_markings(&self) -> Vec<LaneMarkingQuery>
Gets all lane markings along this boundary.
§Returns
A vector of LaneMarkingQuery, each describing a marking and the s-range over which it is valid. The queried results are ordered by increasing s_start. If no markings are available, returns an empty vector.
Sourcepub fn get_markings_by_range(
&self,
s_start: f64,
s_end: f64,
) -> Vec<LaneMarkingQuery>
pub fn get_markings_by_range( &self, s_start: f64, s_end: f64, ) -> Vec<LaneMarkingQuery>
Gets lane markings within a specified s-range.
§Arguments
s_start- Start of the s-range to query.s_end- End of the s-range to query.
§Returns
A vector of LaneMarkingQuery for markings that overlap with the specified range. Queried results are ordered by increasing s_start.
If no markings are available in the range, returns an empty vector.