コード例 #1
0
ファイル: AbstractAirspace.cpp プロジェクト: Advi42/XCSoar
const SearchPointVector&
AbstractAirspace::GetClearance(const FlatProjection &projection) const
{
  #define RADIUS 5

  if (!m_clearance.empty())
    return m_clearance;

  m_clearance = m_border;
  if (is_convex != TriState::FALSE)
    is_convex = m_clearance.PruneInterior() ? TriState::FALSE : TriState::TRUE;

  FlatBoundingBox bb = m_clearance.CalculateBoundingbox();
  FlatGeoPoint center = bb.GetCenter();

  for (SearchPoint &i : m_clearance) {
    FlatGeoPoint p = i.GetFlatLocation();
    FlatRay r(center, p);
    int mag = r.Magnitude();
    int mag_new = mag + RADIUS;
    p = r.Parametric((double)mag_new / mag);
    i = SearchPoint(projection.Unproject(p), p);
  }

  return m_clearance;
}
コード例 #2
0
ファイル: AbstractAirspace.cpp プロジェクト: damianob/xcsoar
const SearchPointVector&
AbstractAirspace::GetClearance(const TaskProjection &projection) const
{
  #define RADIUS 5

  if (!m_clearance.empty())
    return m_clearance;

  m_clearance = m_border;
  if (!m_is_convex)
    m_clearance.PruneInterior();

  FlatBoundingBox bb = m_clearance.CalculateBoundingbox();
  FlatGeoPoint center = bb.GetCenter();

  for (auto i= m_clearance.begin(); i != m_clearance.end(); ++i) {
    FlatGeoPoint p = i->get_flatLocation();
    FlatRay r(center, p);
    int mag = r.Magnitude();
    int mag_new = mag + RADIUS;
    p = r.Parametric((fixed)mag_new / mag);
    *i = SearchPoint(projection.unproject(p), p);
  }

  return m_clearance;
}