Trax3 3.1.0
trax track library
Loading...
Searching...
No Matches
Track's Closest Point

Finds a closest point on a track. If there are more than three foot points on the track to the point in question, the point found might not be the globally closest point on the track, but might be one locally closest. More...

Functions

dclspc Length trax::Closest (const spat::Position< Length > &toPoint, const Track &onTrack, bool includeEndpoints=true)
 Closest point on a track to a point in space.
dclspc Length trax::Closest (const spat::VectorBundle< Length, One > &toRay, const Track &onTrack, bool includeEndpoints=true)
 Closest point on a track to a ray in space.

Detailed Description

Finds a closest point on a track. If there are more than three foot points on the track to the point in question, the point found might not be the globally closest point on the track, but might be one locally closest.

Parameters
toPointtarget point in 3D space.
toRaytarget ray in 3D space.
onTracktrack to look for a close position on.
includeEndpointsIf true, the endpoints of the track are included in the evaluation, even if they are no foot points.
Returns
Parameter value of the point on the track that was found to be closest. If no result was found (only if !includeEndpoints) the return value would be < 0_m.
Exceptions
std::runtime_errorif the track is not valid.