GeoPoint RoutePolars::MSLIntercept(const int index, const AGeoPoint& p, const TaskProjection& proj) const { const unsigned safe_index = ((unsigned)index) % ROUTEPOLAR_POINTS; const FlatGeoPoint fp = proj.ProjectInteger(p); const fixed d = p.altitude * polar_glide.GetPoint(safe_index).inv_gradient; const fixed scale = proj.GetApproximateScale(); const int steps = int(d / scale) + 1; int dx, dy; RoutePolar::IndexToDXDY(safe_index, dx, dy); dx = (dx * steps) >> 7; dy = (dy * steps) >> 7; const FlatGeoPoint dp(fp.longitude + dx, fp.latitude + dy); return proj.Unproject(dp); }
void RouteLink::CalcSpeedups(const TaskProjection& proj) { const fixed scale = proj.GetApproximateScale(); const fixed dx = fixed(first.longitude - second.longitude); const fixed dy = fixed(first.latitude - second.latitude); if (!positive(fabs(dx)) && !positive(fabs(dy))) { d = fixed(0); inv_d = fixed(0); polar_index = 0; return; } mag_rmag(dx, dy, d, inv_d); polar_index = XYToIndex(dx, dy); d *= scale; inv_d /= scale; }