当前位置: 首页>>代码示例>>C++>>正文


C++ AbstractAirspace::ClosestPoint方法代码示例

本文整理汇总了C++中AbstractAirspace::ClosestPoint方法的典型用法代码示例。如果您正苦于以下问题:C++ AbstractAirspace::ClosestPoint方法的具体用法?C++ AbstractAirspace::ClosestPoint怎么用?C++ AbstractAirspace::ClosestPoint使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AbstractAirspace的用法示例。


在下文中一共展示了AbstractAirspace::ClosestPoint方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1:

bool
AirspaceFilterData::Match(const GeoPoint &location,
                          const FlatProjection &projection,
                          const AbstractAirspace &as) const
{
  if (cls != AirspaceClass::AIRSPACECLASSCOUNT && as.GetType() != cls)
    return false;

  if (name_prefix != nullptr && !as.MatchNamePrefix(name_prefix))
    return false;

  if (!direction.IsNegative()) {
    const auto closest = as.ClosestPoint(location, projection);
    const auto bearing = location.Bearing(closest);
    auto direction_error = (bearing - direction).AsDelta().AbsoluteDegrees();
    if (direction_error > fixed(18))
      return false;
  }

  if (!negative(distance)) {
    const auto closest = as.ClosestPoint(location, projection);
    const auto distance = location.Distance(closest);
    if (distance > distance)
      return false;
  }

  return true;
}
开发者ID:ThomasXBMC,项目名称:XCSoar,代码行数:28,代码来源:AirspaceSorter.cpp

示例2: NearestAirspace

static inline NearestAirspace
CalculateNearestAirspaceHorizontal(const GeoPoint &location,
                                   const FlatProjection &projection,
                                   const AbstractAirspace &airspace)
{
  const auto closest = airspace.ClosestPoint(location, projection);
  assert(closest.IsValid());

  return NearestAirspace(airspace, closest.DistanceS(location));
}
开发者ID:Advi42,项目名称:XCSoar,代码行数:10,代码来源:NearestAirspace.cpp

示例3: Invalid

AirspaceInterceptSolution
AirspaceNearestSort::solve_intercept(const AbstractAirspace &a) const
{
  if (a.Inside(m_location)) {
    return AirspaceInterceptSolution::Invalid();
  } else {
    AirspaceInterceptSolution sol;
    sol.location = a.ClosestPoint(m_location);
    sol.distance = sol.location.Distance(m_location);
    return sol;
  }
}
开发者ID:davidswelt,项目名称:XCSoar,代码行数:12,代码来源:AirspaceNearestSort.cpp

示例4: closest

 void closest(const AbstractAirspace &as) {
   GeoPoint c = as.ClosestPoint(state.location, projection);
   if (fout) {
     *fout << "# closest point\n";
     *fout << c.longitude << " " << c.latitude << " " << "\n";
     *fout << state.location.longitude << " " << state.location.latitude << " " << "\n\n";
   }
   AirspaceInterceptSolution solution;
   GeoVector vec(state.location, c);
   vec.distance = fixed(20000); // set big distance (for testing)
   if (as.Intercept(state, vec.EndPoint(state.location), projection, m_perf, solution)) {
     if (fout) {
       *fout << "# intercept in " << solution.elapsed_time << " h " << solution.altitude << "\n";
     }
   }
 }
开发者ID:Andy-1954,项目名称:XCSoar,代码行数:16,代码来源:harness_airspace.cpp

示例5: SoonestAirspace

static inline SoonestAirspace
CalculateSoonestAirspace(const AircraftState &state,
                         const AirspaceAircraftPerformance &perf,
                         const double max_time,
                         const FlatProjection &projection,
                         const AbstractAirspace &airspace)
{
  const auto closest = airspace.ClosestPoint(state.location, projection);
  assert(closest.IsValid());

  const auto solution = airspace.Intercept(state, perf, closest, closest);
  if (!solution.IsValid() ||
      solution.elapsed_time > max_time)
    return SoonestAirspace();

  return SoonestAirspace(airspace, solution.elapsed_time);
}
开发者ID:Advi42,项目名称:XCSoar,代码行数:17,代码来源:SoonestAirspace.cpp

示例6: fixed

AirspaceInterceptSolution
AirspaceSoonestSort::solve_intercept(const AbstractAirspace &a,
                                     const TaskProjection &projection) const
{
  const GeoPoint loc = a.ClosestPoint(m_state.location, projection);

  AirspaceInterceptSolution sol =
    AirspaceInterceptSolution::Invalid();
  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(-1);
  }
  return sol;
}
开发者ID:Adrien81,项目名称:XCSoar,代码行数:18,代码来源:AirspaceSoonestSort.cpp


注:本文中的AbstractAirspace::ClosestPoint方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。