void ClothoidPath::MakeSmoothPath( MyTrack* pTrack, const CarModel& cm, const Options& opts ) { // m_factor = factor; LinePath::Initialise( pTrack, opts.maxL, opts.maxR ); const int NSEG = pTrack->GetSize(); CalcCurvaturesZ(); int fwdRange = 110; CalcFwdAbsK( fwdRange ); const int delta = 25; const int n = (150 + delta - 1) / delta; int step = 1; while( step * 4 < NSEG ) step *= 2; do { step = (step + 1) / 2; // int n = 100 * int(sqrt(step)); for( int i = 0; i < n; i++ ) { OptimisePath( cm, step, delta, 0 ); } } while( step > 1 ); if( opts.bumpMod ) { CalcCurvaturesZ(); CalcFwdAbsK( fwdRange ); AnalyseBumps( cm, false ); step = 8; do { step = (step + 1) / 2; for( int i = 0; i < n; i++ ) { OptimisePath( cm, step, delta, opts.bumpMod ); CalcFwdAbsK( fwdRange ); CalcMaxSpeeds( cm, step ); PropagateBreaking( cm, step ); PropagateAcceleration( cm, step ); } } while( step > 1 ); } CalcCurvaturesZ(); }
//==========================================================================* // Create a smooth lane //--------------------------------------------------------------------------* void TClothoidLane::MakeSmoothPath( TTrackDescription* Track, TParam& Param, const TOptions& Opts) { TCarParam* CarParam = &Param.oCarParam; if (Opts.Side) CarParam = &Param.oCarParam2; TLane::Initialise(Track, Param.Fix, *CarParam, Opts.MaxL, Opts.MaxR); oCount = Track->Count(); //const int Count = Track->Count(); int FwdRange = 110; CalcFwdAbsCrv(FwdRange); const int Delta = 25; const int L = 8; int Step = 1; // Initialize step width while (Step * 16 < oCount) // Find largest step width Step *= 2; while (Step > 0) { for (int I = 0; I < L; I++) OptimisePath(Step, Delta, 0); Step >>= 1; } if (Opts.BumpMod) { AnalyseBumps(false); Step = 1; Step <<= ANALYSE_STEPS; while (Step > 0) { for (int I = 0; I < L; I++) { OptimisePath(Step, Delta, Opts.BumpMod); CalcCurvaturesZ(); CalcFwdAbsCrv(FwdRange); CalcMaxSpeeds(Step); PropagateBreaking(Step); PropagateAcceleration(Step); } Step >>= 1; } }
//==========================================================================* // Create a smooth lane //--------------------------------------------------------------------------* void TClothoidLane::MakeSmoothPath( TTrackDescription* Track, TParam& Param, const TOptions& Opts) { TCarParam& CarParam = Param.oCarParam; oBase = Opts.Base; oBaseFactor = Opts.BaseFactor; if (Opts.MaxR < FLT_MAX) LaneType = ltLeft; else if (Opts.MaxL < FLT_MAX) LaneType = ltRight; else LaneType = ltFree; if (Opts.Side) { LogSimplix.debug("Switch to CarParam2\n"); CarParam = Param.oCarParam2; } TLane::Initialise(Track, Param.Fix, CarParam, Opts.MaxL, Opts.MaxR); const int Count = Track->Count(); int FwdRange = 110; CalcFwdAbsCrv(FwdRange); const int Delta = 25; int L = 8; int Step = 1; // Initialize step width while (Step * 16 < Count) // Find largest step width Step *= 2; LogSimplix.debug("OptimisePath:\n"); while (Step > 0) { LogSimplix.debug("Step: %d\n",Step); for (int I = 0; I < L; I++) { OptimisePath(Step, Delta, 0, Param.oCarParam.oUglyCrvZ); } Step >>= 1; } if (Opts.BumpMod) { LogSimplix.debug("AnalyseBumps:\n"); AnalyseBumps(false); //AnalyseBumps(true); Step = 1; Step <<= ANALYSE_STEPS; while (Step > 0) { LogSimplix.debug("Step: %d\n",Step); for (int I = 0; I < L; I++) { OptimisePath(Step, Delta, Opts.BumpMod, Param.oCarParam.oUglyCrvZ); CalcCurvaturesZ(); CalcFwdAbsCrv(FwdRange); CalcMaxSpeeds(Step); PropagateBreaking(Step); PropagateAcceleration(Step); } Step >>= 1; } }