示例#1
0
void
StartPoint::find_best_start(const AircraftState &state,
                            const OrderedTaskPoint &next,
                            const TaskProjection &projection)
{
  /* check which boundary point results in the smallest distance to
     fly */

  const OZBoundary boundary = next.GetBoundary();
  assert(!boundary.empty());

  const auto end = boundary.end();
  auto i = boundary.begin();
  assert(i != end);

  const GeoPoint &next_location = next.GetLocationRemaining();

  GeoPoint best_location = *i;
  fixed best_distance = ::DoubleDistance(state.location, *i, next_location);

  for (++i; i != end; ++i) {
    fixed distance = ::DoubleDistance(state.location, *i, next_location);
    if (distance < best_distance) {
      best_location = *i;
      best_distance = distance;
    }
  }

  SetSearchMin(SearchPoint(best_location, projection));
}
示例#2
0
void
PrintHelper::orderedtaskpoint_print_boundary(std::ostream& f,
        const OrderedTaskPoint& tp,
        const AircraftState &state)
{
    f << "#   Boundary points\n";
    for (const auto &i : tp.GetBoundary())
        f << "     " << i.longitude << " " << i.latitude << "\n";
    f << "\n";
}