A Location helps with moving along a system of connected tracks. It provides methods for determining the exact position on the track system, which would be the Track and some TrackLocation that specifies the parameter and an Orientation; as well as location_getters getter methods to transition the track's position to 3D positional and orientational data. Besides from moving the Location, the Location::Move methods will trigger Sensors and help communicating with Signals along the way.
auto pTrack1 = TrackBuilder::Make();
auto pTrack2 = TrackBuilder::Make();
auto pTrack3 = TrackBuilder::Make();
auto pTrack4 = TrackBuilder::Make();
auto pArc1 = ArcP::Make();
pArc1->Create( { Origin3D<Length>, { 1, 0, 0 }, { 0, 10, 0 } } );
pTrack1->Attach( std::move(pArc1), {0
_m,10
_m*
pi/2} );
auto pArc2 = ArcP::Make();
pArc2->Create( { Origin3D<Length>, { 0, 1, 0 }, { -10, 0, 0 } } );
pTrack2->Attach( std::move(pArc2), {0
_m,10
_m*
pi/2} );
auto pArc3 = ArcP::Make();
pArc3->Create( { Origin3D<Length>, { -1, 0, 0 }, { 0, -10, 0 } } );
pTrack3->Attach( std::move(pArc3), {0
_m,10
_m*
pi/2} );
auto pArc4 = ArcP::Make();
pArc4->Create( { Origin3D<Length>, { 0, -1, 0 }, { 10, 0, 0 } } );
pTrack4->Attach( std::move(pArc4), {0
_m, 10
_m*
pi/2} );
pTrack1->Couple( std::make_pair(pTrack1, Track::EndType::end), std::make_pair(pTrack2, Track::EndType::front) );
pTrack2->Couple( std::make_pair(pTrack2, Track::EndType::end), std::make_pair(pTrack3, Track::EndType::front) );
pTrack3->Couple( std::make_pair(pTrack3, Track::EndType::end), std::make_pair(pTrack4, Track::EndType::front) );
pTrack4->Couple( std::make_pair(pTrack4, Track::EndType::end), std::make_pair(pTrack1, Track::EndType::front) );
Location loc{ pTrack1, { 0
_m, Orientation::Value::para } };
Frame<Length,One> frame1, frame2;
loc.Transition( frame1 );
loc.Move( pTrack1->GetLength() + pTrack2->GetLength() + pTrack3->GetLength() + pTrack4->GetLength() );
loc.Transition( frame2 );
BOOST_CHECK( frame1.Equals( frame2, epsilon__length, 0.001f ) );
loc.Move( pTrack1->GetLength() + pTrack2->GetLength() + pTrack3->GetLength()/2 );
auto pTrack = loc.GetTrack();
BOOST_CHECK( pTrack == pTrack3 );
pTrack1->DeCouple();
pTrack3->DeCouple();
constexpr Angle pi
Circle number pi.
Definition DimensionedValues.h:1145
constexpr Real _m(Length l) noexcept
Dimensionated Values conversion functions.
Definition DimensionedValues.h:1210
Do also look at the tests in the test suit for further examples.