コード例 #1
0
AirspaceInterceptSolution
AirspaceNearestSort::solve_intercept(const AbstractAirspace &a) const
{
  if (a.inside(m_location)) {
    AirspaceInterceptSolution null_sol;
    return null_sol;
  } else {
    AirspaceInterceptSolution sol;
    sol.location = a.closest_point(m_location);
    sol.distance = sol.location.distance(m_location);
    return sol;
  }
}
コード例 #2
0
ファイル: AirspaceSoonestSort.cpp プロジェクト: Mrdini/XCSoar
AirspaceInterceptSolution 
AirspaceSoonestSort::solve_intercept(const AbstractAirspace &a) const
{
  const GeoPoint loc = a.closest_point(m_state.Location);

  AirspaceInterceptSolution sol;
  bool valid = a.intercept(m_state, m_perf, sol, loc, loc);

  if (sol.elapsed_time > m_max_time) {
    valid = false;
  }
  if (!valid) {
    sol.elapsed_time = -fixed_one;
  }
  return sol;
}
コード例 #3
0
  virtual void closest(const AbstractAirspace& as) {
    GeoPoint c = as.closest_point(state.Location);
#ifdef DO_PRINT
    *fout << "# closest point\n";
    *fout << c.Longitude << " " << c.Latitude << " " << "\n";
    *fout << state.Location.Longitude << " " << state.Location.Latitude << " " << "\n\n";
#endif
    AirspaceInterceptSolution solution;
    GeoVector vec(state.Location, c);
    vec.Distance = fixed(20000); // set big distance (for testing)
    if (as.intercept(state, vec, m_perf, solution)) {
#ifdef DO_PRINT
      *fout << "# intercept in " << solution.elapsed_time << " h " << solution.altitude << "\n";
#endif
    }
  }