distanceTo
Returns the tree distance from the specified position to the start offset of the given horizon element.
The distance is strictly positive for elements in front of the position, i.e.:
Elements on the position path in front of the position (the start offset of the element is greater than the position offset).
Elements on sub-paths that the vehicle can reach by successively deviating to child paths.
The distance is strictly negative for elements behind the vehicle that the vehicle has moved past, i.e.:
Elements on the position path that are completely behind the position or overlap the position, but start before the position (the start offset of the element is less than the position offset).
Elements on sub-paths that the vehicle has deviated from at some point in the past.
The distance is 0 for elements that start at the position (the start offset of the element on the position path is the same as the position offset).
The distance is null if any of the following is true:
There is no path in the snapshot with the same ID as the one stored in the position
The given element does not exist in the snapshot
The given element is an element behind the position that the vehicle has not moved past, i.e., elements on sub-paths behind the vehicle that the vehicle has not taken.
Return
Tree distance to the given horizon element.
Parameters
Horizon element to compute the tree distance for.
Horizon position to compute the tree distance from.