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


C++ GeoVector函数代码示例

本文整理汇总了C++中GeoVector函数的典型用法代码示例。如果您正苦于以下问题:C++ GeoVector函数的具体用法?C++ GeoVector怎么用?C++ GeoVector使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: GetStartRadial

OZBoundary
AnnularSectorZone::GetBoundary() const
{
  OZBoundary boundary;

  const unsigned steps = 20;
  const Angle delta = Angle::FullCircle() / steps;
  const Angle start = GetStartRadial().AsBearing();
  Angle end = GetEndRadial().AsBearing();
  if (end <= start + Angle::FullCircle() / 512)
    end += Angle::FullCircle();

  const GeoPoint inner_start =
    GeoVector(GetInnerRadius(), GetStartRadial()).EndPoint(GetReference());
  const GeoPoint inner_end =
    GeoVector(GetInnerRadius(), GetEndRadial()).EndPoint(GetReference());

  GeoVector inner_vector(GetInnerRadius(), start + delta);
  for (; inner_vector.bearing < end; inner_vector.bearing += delta)
    boundary.push_front(inner_vector.EndPoint(GetReference()));

  boundary.push_front(inner_end);
  boundary.push_front(inner_start);

  GeoVector vector(GetRadius(), start + delta);
  for (; vector.bearing < end; vector.bearing += delta)
    boundary.push_front(vector.EndPoint(GetReference()));

  boundary.push_front(GetSectorEnd());
  boundary.push_front(GetSectorStart());

  return boundary;
}
开发者ID:Adrien81,项目名称:XCSoar,代码行数:33,代码来源:AnnularSectorZone.cpp

示例2: GeoVector

GeoPoint
AircraftSim::endpoint(const Angle &heading, const fixed timestep) const
{
  GeoPoint ref = GeoVector(state.true_airspeed*timestep, heading).end_point(state.location);
  return GeoVector(state.wind.norm*timestep,
                   state.wind.bearing+ Angle::degrees(fixed_180)).end_point(ref);
}
开发者ID:macsux,项目名称:XCSoar,代码行数:7,代码来源:AircraftSim.cpp

示例3: switch

GeoVector 
TaskLeg::leg_vector_remaining(const GeoPoint &ref) const
{
  switch (destination.getActiveState()) {
  case OrderedTaskPoint::AFTER_ACTIVE:
    if (!origin()) {
      return GeoVector(fixed_zero);
    }
    // this leg totally included
    return memo_remaining.calc(origin()->get_location_remaining(), 
                               destination.get_location_remaining());
    break;
  case OrderedTaskPoint::CURRENT_ACTIVE:
    if (!origin()) {
      return GeoVector(fixed_zero, 
                       ref.bearing(destination.get_location_remaining()));
    }
    // this leg partially included
    return memo_remaining.calc(ref, 
                               destination.get_location_remaining());
    break;
  case OrderedTaskPoint::BEFORE_ACTIVE:
    // this leg not included
  default:
    assert(1); // error!
    return GeoVector(fixed_zero);
  };
}
开发者ID:galippi,项目名称:xcsoar,代码行数:28,代码来源:TaskLeg.cpp

示例4: fixed

const FlatBoundingBox 
AirspaceCircle::get_bounding_box(const TaskProjection& task_projection) 
{
  static const Angle a225 = Angle::degrees(fixed(225));
  static const Angle a135 = Angle::degrees(fixed(135));
  static const Angle a045 = Angle::degrees(fixed(045));
  static const Angle a315 = Angle::degrees(fixed(315));

  const fixed eradius = m_radius * fixed(1.42);
  const GeoPoint ll = GeoVector(eradius, a225).end_point(m_center);
  const GeoPoint lr = GeoVector(eradius, a135).end_point(m_center);
  const GeoPoint ur = GeoVector(eradius, a045).end_point(m_center);
  const GeoPoint ul = GeoVector(eradius, a315).end_point(m_center);

  FlatGeoPoint fll = task_projection.project(ll);
  FlatGeoPoint flr = task_projection.project(lr);
  FlatGeoPoint ful = task_projection.project(ul);
  FlatGeoPoint fur = task_projection.project(ur);

  // note +/- 1 to ensure rounding keeps bb valid 

  return FlatBoundingBox(FlatGeoPoint(min(fll.Longitude, ful.Longitude) - 1,
                                      min(fll.Latitude, flr.Latitude) - 1),
                         FlatGeoPoint(max(flr.Longitude, fur.Longitude) + 1,
                                      max(ful.Latitude, fur.Latitude) + 1));
}
开发者ID:Plantain,项目名称:XCSoar,代码行数:26,代码来源:AirspaceCircle.cpp

示例5: GetHome

GeoVector 
AbortTask::GetHomeVector(const AircraftState &state) const
{
  const Waypoint *home_waypoint = GetHome();
  if (home_waypoint)
    return GeoVector(state.location, home_waypoint->location);

  return GeoVector(fixed_zero);
}
开发者ID:FlorianR,项目名称:XCSoar,代码行数:9,代码来源:AbortTask.cpp

示例6: getStartRadial

GeoPoint 
BGAEnhancedOptionZone::get_boundary_parametric(fixed t) const
{ 
  const Angle half = getStartRadial().HalfAngle(getEndRadial());
  const Angle angle = (Angle::radians(t*fixed_two_pi)+half).as_bearing();
  if (angleInSector(angle)) {
    return GeoVector(Radius, angle).end_point(get_location());
  } else {
    return GeoVector(fixed(500), angle).end_point(get_location());
  }
}
开发者ID:galippi,项目名称:xcsoar,代码行数:11,代码来源:BGAEnhancedOptionZone.cpp

示例7: GetVector

  GeoVector 
  GetVector(fixed time) const
  {
    assert(Ready());

    if (!positive(p[2].t-p[1].t)) {
      return GeoVector(fixed_zero, Angle::zero());
    }

    const Record r0 = Interpolate(time - fixed(0.05));
    const Record r1 = Interpolate(time + fixed(0.05));
    return GeoVector(p[1].loc.distance(p[2].loc)/
                     (p[2].t-p[1].t), r0.loc.bearing(r1.loc));
  }
开发者ID:macsux,项目名称:XCSoar,代码行数:14,代码来源:CatmullRomInterpolator.hpp

示例8: if

GeoPoint
AnnularSectorZone::GetBoundaryParametric(fixed t) const
{
  const Angle sweep = (EndRadial-StartRadial).as_bearing();
  const fixed c0 = sweep.value_radians()*InnerRadius;
  const fixed l = Radius-InnerRadius;
  const fixed c1 = sweep.value_radians()*Radius;
  const fixed tt = t*(c0+c1+2*l);
  Angle a;
  fixed d;
  if (tt< c0) {
    d = InnerRadius;
    a = Angle::radians((tt/c0)*sweep.value_radians())+StartRadial;
  } else if (positive(l) && (tt<c0+l)) {
    d = (tt-c0)/l*(Radius-InnerRadius)+InnerRadius;
    a = EndRadial;
  } else if (tt<c0+l+c1) {
    d = Radius;
    a = EndRadial-Angle::radians(((tt-c0-l)/c1)*sweep.value_radians());
  } else if (positive(l)) {
    d = (tt-c0-l-c1)/l*(InnerRadius-Radius)+Radius;
    a = StartRadial;
  } else {
    d = InnerRadius;
    a = StartRadial;
  }
  return GeoVector(d, a).end_point(get_location());
}
开发者ID:macsux,项目名称:XCSoar,代码行数:28,代码来源:AnnularSectorZone.cpp

示例9: getStartRadial

GeoPoint 
KeyholeZone::get_boundary_parametric(fixed t) const
{ 
  const fixed sweep = (getEndRadial() - getStartRadial()).as_bearing().value_radians();
  const fixed small_sweep = fixed_two_pi-sweep;
  const fixed SmallRadius = fixed(500);
  const fixed c1 = sweep*Radius; // length of sector element
  const fixed c2 = small_sweep*SmallRadius*fixed(5); // length of cylinder element
  const fixed l = (Radius-SmallRadius)*fixed(0.2); // length of straight elements
  const fixed tt = t*(c1+l+l+c2); // total distance
  Angle a;
  fixed d;
  if (tt<l) { // first straight element
    d = (tt/l)*(Radius-SmallRadius)+SmallRadius;
    a = getStartRadial();
  } else if (tt<l+c1) { // sector element
    d = Radius;
    a = getStartRadial() + Angle::radians((tt-l)/c1*sweep);
  } else if (tt<l+l+c1) { // second straight element
    d = (fixed_one-(tt-l-c1)/l)*(Radius-SmallRadius)+SmallRadius;
    a = getEndRadial();
  } else { // cylinder element
    d = SmallRadius;
    a = getEndRadial() + Angle::radians((tt-l-l-c1)/c2*small_sweep);
  }
  return GeoVector(d, a).end_point(get_location());
}
开发者ID:joachimwieland,项目名称:xcsoar-jwieland,代码行数:27,代码来源:KeyholeZone.cpp

示例10: OnPaintListItem

static void
OnPaintListItem(Canvas &canvas, const PixelRect rc, unsigned i)
{
  if (waypoint_select_info.empty()) {
    assert(i == 0);

    const UPixelScalar line_height = rc.bottom - rc.top;
    const Font &name_font =
      *UIGlobals::GetDialogLook().list.font;
    canvas.SetTextColor(COLOR_BLACK);
    canvas.Select(name_font);
    canvas.text(rc.left + line_height + Layout::FastScale(2),
                rc.top + line_height / 2 - name_font.GetHeight() / 2,
                filter_data.IsDefined() || way_points.IsEmpty() ?
                _("No Match!") : _("Choose a filter or click here"));
    return;
  }

  assert(i < waypoint_select_info.size());

  const struct WaypointSelectInfo &info = waypoint_select_info[i];

  WaypointListRenderer::Draw(canvas, rc, *info.waypoint,
                             GeoVector(info.distance, info.direction),
                             UIGlobals::GetDialogLook(),
                             UIGlobals::GetMapLook().waypoint,
                             CommonInterface::GetMapSettings().waypoint);
}
开发者ID:mobotics,项目名称:XCSoar,代码行数:28,代码来源:dlgWaypointSelect.cpp

示例11: GetVector

  GeoVector 
  GetVector(fixed _time) const
  {
    assert(Ready());

    if (!positive(p[2].time-p[1].time))
      return GeoVector(fixed(0), Angle::Zero());

    const Record r0 = Interpolate(_time - fixed(0.05));
    const Record r1 = Interpolate(_time + fixed(0.05));

    fixed speed = p[1].location.Distance(p[2].location) / (p[2].time - p[1].time);
    Angle bearing = r0.location.Bearing(r1.location);

    return GeoVector(speed, bearing);
  }
开发者ID:StefanL74,项目名称:XCSoar,代码行数:16,代码来源:CatmullRomInterpolator.hpp

示例12: GetVector

  GeoVector 
  GetVector(fixed time) const
  {
    if (!Ready())
      return fixed_zero;

    if (!positive(p[2].t-p[1].t)) {
      return GeoVector(fixed_zero, Angle::native(fixed_zero));
    }
    fixed alt, palt;
    GeoPoint p0, p1;
    Interpolate(time-fixed(0.05), p0, alt, palt);
    Interpolate(time+fixed(0.05), p1, alt, palt);
    return GeoVector(p[1].loc.distance(p[2].loc)/
                     (p[2].t-p[1].t), p0.bearing(p1));
  }
开发者ID:galippi,项目名称:xcsoar,代码行数:16,代码来源:CatmullRomInterpolator.hpp

示例13: GetStartRadial

GeoPoint
AnnularSectorZone::GetBoundaryParametric(fixed t) const
{
  const Angle sweep = (GetEndRadial() - GetStartRadial()).AsBearing();
  const fixed c0 = sweep.Radians() * inner_radius;
  const fixed l = GetRadius() - inner_radius;
  const fixed c1 = sweep.Radians() * GetRadius();
  const fixed tt = t * (c0 + c1 + 2 * l);
  Angle a;
  fixed d;
  if (tt < c0) {
    d = inner_radius;
    a = Angle::Radians((tt / c0) * sweep.Radians()) + GetStartRadial();
  } else if (positive(l) && (tt < c0 + l)) {
    d = (tt - c0) / l * (GetRadius() - inner_radius) + inner_radius;
    a = GetEndRadial();
  } else if (tt < c0 + l + c1) {
    d = GetRadius();
    a = GetEndRadial()
        - Angle::Radians(((tt - c0 - l) / c1) * sweep.Radians());
  } else if (positive(l)) {
    d = (tt - c0 - l - c1) / l * (inner_radius - GetRadius()) + GetRadius();
    a = GetStartRadial();
  } else {
    d = inner_radius;
    a = GetStartRadial();
  }
  return GeoVector(d, a).EndPoint(GetReference());
}
开发者ID:alon,项目名称:xcsoar,代码行数:29,代码来源:AnnularSectorZone.cpp

示例14: assert

void
TrafficListWidget::UpdateList()
{
  assert(filter_widget != nullptr);

  items.clear();
  last_update.Clear();

  const TCHAR *callsign = filter_widget->GetValueString(CALLSIGN);
  if (!StringIsEmpty(callsign)) {
    FlarmId ids[30];
    unsigned count = FlarmDetails::FindIdsByCallSign(callsign, ids, 30);

    for (unsigned i = 0; i < count; ++i)
      AddItem(ids[i]);
  } else {
    /* if no filter was set, show a list of current traffic and known
       traffic */

    /* add live FLARM traffic */
    for (const auto &i : CommonInterface::Basic().flarm.traffic.list) {
      AddItem(i.id);
    }

    /* add FLARM peers that have a user-defined color */
    for (const auto &i : traffic_databases->flarm_colors) {
      Item &item = AddItem(i.first);
      item.color = i.second;
    }

    /* add FLARM peers that have a user-defined name */
    for (const auto &i : traffic_databases->flarm_names) {
      AddItem(i.id);
    }

#ifdef HAVE_SKYLINES_TRACKING_HANDLER
    /* show SkyLines traffic unless this is a FLARM traffic picker
       dialog (from dlgTeamCode) */
    if (action_listener == nullptr) {
      const auto &data = tracking->GetSkyLinesData();
      const ScopeLock protect(data.mutex);
      for (const auto &i : data.traffic) {
        items.emplace_back(i.first, i.second.location);
        Item &item = items.back();

        if (i.second.location.IsValid() &&
            CommonInterface::Basic().location_available)
          item.vector = GeoVector(CommonInterface::Basic().location,
                                  i.second.location);
      }
    }
#endif
  }

  GetList().SetLength(items.size());

  UpdateVolatile();
  UpdateButtons();
}
开发者ID:henrik1g,项目名称:XCSoar,代码行数:59,代码来源:TrafficList.cpp

示例15: GeoVector

const GeoVector &
WaypointListItem::GetVector(const GeoPoint &location) const
{
  if (!vec.IsValid())
    vec = GeoVector(location, waypoint->location);

  return vec;
}
开发者ID:MindMil,项目名称:XCSoar,代码行数:8,代码来源:WaypointList.cpp


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