bool
SearchPointVector::IntersectsWith(const FlatRay &ray) const
{
  for (auto it = begin(); it + 1 != end(); ++it) {
    const FlatRay r_seg(it->GetFlatLocation(), (it + 1)->GetFlatLocation());

    if (r_seg.IntersectsDistinct(ray))
      return true;
  }
  return false;
}
Exemple #2
0
AirspaceIntersectionVector
AirspacePolygon::Intersects(const GeoPoint &start, const GeoPoint &end) const
{
  const FlatRay ray(m_task_projection->project(start),
                    m_task_projection->project(end));

  AirspaceIntersectSort sorter(start, end, *this);

  for (auto it = m_border.begin(); it + 1 != m_border.end(); ++it) {

    const FlatRay r_seg(it->get_flatLocation(), (it + 1)->get_flatLocation());
    fixed t;
    if (ray.IntersectsDistinct(r_seg, t))
      sorter.add(t, m_task_projection->unproject(ray.Parametric(t)));
  }

  return sorter.all();
}