double MyTrack::CalcPos( double x, double y, const Seg* hint, bool sides ) const { tTrackSeg* pTrackSeg = m_pSegs[0].pSeg; if( hint != 0 ) pTrackSeg = hint->pSeg; tTrkLocPos pos; RtTrackGlobal2Local( pTrackSeg, x, y, &pos, sides ); double dist = RtGetDistFromStart2(&pos); return dist; }
//==========================================================================* // Calc position from coordinates //--------------------------------------------------------------------------* double TTrackDescription::CalcPos (float X, float Y, const TSection* Hint, bool Sides) const { tTrackSeg* Seg = oSections[0].Seg; if(Hint != 0) Seg = Hint->Seg; tTrkLocPos Pos; RtTrackGlobal2Local(Seg, X, Y, &Pos, Sides ); return RtGetDistFromStart2(&Pos); }
double MyTrack::CalcPos( tTrkLocPos& trkPos, double offset ) const { double pos = RtGetDistFromStart2(&trkPos) + offset; return NormalisePos(pos); }
//==========================================================================* // Calc position from offset //--------------------------------------------------------------------------* double TTrackDescription::CalcPos(tTrkLocPos& TrkPos, double Offset) const { double Pos = RtGetDistFromStart2(&TrkPos) + Offset; return NormalizePos(Pos); // Normalize to >= 0.0 }
/** Get the distance from the start lane. @ingroup tracktools @param car the concerned car. @return The distance between the start lane and the car. */ tdble RtGetDistFromStart(tCarElt *car) { tTrkLocPos *p = &(car->_trkPos); return RtGetDistFromStart2(p); }