pub trait RailwayEdgeAlgos {
    // Required methods
    fn distance_to_end(
        &self,
        current_location: Coord<f64>,
        direction_coord: Coord<f64>
    ) -> Length;
    fn position_on_edge(
        &self,
        current_location: Coord<f64>,
        distance_to_travel: Length,
        direction_coord: Coord<f64>
    ) -> Coord<f64>;
}
Expand description

Algorithms for railway edges.

Required Methods§

source

fn distance_to_end( &self, current_location: Coord<f64>, direction_coord: Coord<f64> ) -> Length

Calculates the distance between the current location and the last coordinate in the linestring.

Arguments
  • current_location - A Coord<f64> representing the current location on the edge.
  • direction_coord - A Coord<f64> representing the target direction along the edge.
Returns

A f64 representing the distance to the last coordinate in the linestring.

source

fn position_on_edge( &self, current_location: Coord<f64>, distance_to_travel: Length, direction_coord: Coord<f64> ) -> Coord<f64>

Calculates a new position on the edge based on the given parameters.

Arguments
  • current_location - A Coord<f64> representing the current location on the edge.
  • distance_to_travel - A f64 representing the distance to travel along the edge from the current location.
  • direction_coord - A Coord<f64> representing the target direction along the edge.
Returns

A Coord<f64> representing the new position on the edge after traveling the specified distance in the given direction.

Implementors§