Skip to main content

LaneBoundary

Struct LaneBoundary 

Source
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>

Source

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.

Source

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.

Source

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).

Source

pub fn lane_to_left(&self) -> Option<Lane<'a>>

Returns the Lane immediately to the left of this boundary (increasing r direction).

§Returns

An Option<Lane> containing the lane to the left, or None if this is the leftmost boundary of the Segment.

Source

pub fn lane_to_right(&self) -> Option<Lane<'a>>

Returns the Lane immediately to the right of this boundary (decreasing r direction).

§Returns

An Option<Lane> containing the lane to the right, or None if this is the rightmost boundary of the Segment.

Source

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.

Source

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.

Source

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.

Auto Trait Implementations§

§

impl<'a> Freeze for LaneBoundary<'a>

§

impl<'a> RefUnwindSafe for LaneBoundary<'a>

§

impl<'a> !Send for LaneBoundary<'a>

§

impl<'a> !Sync for LaneBoundary<'a>

§

impl<'a> Unpin for LaneBoundary<'a>

§

impl<'a> UnwindSafe for LaneBoundary<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.