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


C++ TracePoint::get_location方法代码示例

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


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

示例1:

static void
PrintTracePoint(const TracePoint &point, std::ofstream& fs)
{
  fs << point.GetTime()
     << " " << point.get_location().longitude
     << " " << point.get_location().latitude
     << " " << point.GetAltitude()
     << " " << point.GetVario()
     << "\n";
}
开发者ID:davidswelt,项目名称:XCSoar,代码行数:10,代码来源:Printing.cpp

示例2: Result

TriangleSecondLeg::Result
TriangleSecondLeg::Calculate(const TracePoint &c, unsigned best) const
{
  // this is a heuristic to remove invalid triangles
  // we do as much of this in flat projection for speed

  const unsigned df_2 = b.flat_distance(c);
  const unsigned df_3 = c.flat_distance(a);
  const unsigned df_total = df_1+df_2+df_3;

  // require some distance!
  if (df_total<20) {
    return Result(0, 0);
  }

  // no point scanning if worst than best
  if (df_total<= best) {
    return Result(0, 0);
  }

  const unsigned shortest = min(df_1, min(df_2, df_3));

  // require all legs to have distance
  if (!shortest) {
    return Result(0, 0);
  }

  if (is_fai && (shortest*4<df_total)) { // fails min < 25% worst-case rule!
    return Result(0, 0);
  }

  const unsigned d = df_3+df_2;

  // without FAI rules, allow any triangle
  if (!is_fai) {
    return Result(d, df_total);
  }

  if (shortest*25>=df_total*7) { 
    // passes min > 28% rule,
    // this automatically means we pass max > 45% worst-case
    return Result(d, df_total);
  }

  const unsigned longest = max(df_1, max(df_2, df_3));
  if (longest*20>df_total*9) { // fails max > 45% worst-case rule!
    return Result(0, 0);
  }

  // passed basic tests, now detailed ones

  // find accurate min leg distance
  fixed leg(0);
  if (df_1 == shortest) {
    leg = a.get_location().distance(b.get_location());
  } else if (df_2 == shortest) {
    leg = b.get_location().distance(c.get_location());
  } else if (df_3 == shortest) {
    leg = c.get_location().distance(a.get_location());
  }

  // estimate total distance by scaling.
  // this is a slight approximation, but saves having to do
  // three accurate distance calculations.

  const fixed d_total((df_total*leg)/shortest);
  if (d_total>=fixed(500000)) {
    // long distance, ok that it failed 28% rule
    return Result(d, df_total);
  }

  return Result(0, 0);
}
开发者ID:macsux,项目名称:XCSoar,代码行数:73,代码来源:OLCTriangle.cpp


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