Added functions to query and traverse using GraphCoords.

This commit is contained in:
Patrick Marsee 2025-02-10 23:01:36 -05:00
parent 55d21880ec
commit 2db8b1f9e9
5 changed files with 307 additions and 13 deletions

View file

@ -89,10 +89,17 @@ pub trait RailSegment {
*/
fn sample_up_vector(&self, index: usize, offset: f32) -> Result<Vector3, Error>;
/** Check if a subsegment is valid.
*/
fn has_subsegment(&self, index: usize) -> bool;
// endpoint functions
/** Get the segment index associated with an endpoint. */
fn segment_from_endpoint(&self, endpoint: usize) -> Result<usize, Error>;
fn subsegment_from_endpoint(&self, endpoint: usize) -> Result<usize, Error>;
/** Get the segment index associated with an endpoint. */
fn endpoint_from_subsegment(&self, index: usize, is_upper: bool) -> Result<usize, Error>;
/** Get the location of an endpoint. */
fn get_endpoint_transform(&self, endpoint: usize) -> Result<Transform3D, Error>;