Exemplo n.º 1
0
AirspaceIntersectionVector
AirspacePolygon::intersects(const GeoPoint& start, 
                            const GeoVector &vec) const
{
  const GeoPoint end = vec.end_point(start);
  const FlatRay ray(m_task_projection->project(start),
                    m_task_projection->project(end));

  AirspaceIntersectSort sorter(start, end, *this);

  for (SearchPointVector::const_iterator it= m_border.begin();
       it+1 != m_border.end(); ++it) {

    const FlatRay r_seg(it->get_flatLocation(), 
                        (it+1)->get_flatLocation());

    const fixed t = ray.intersects(r_seg);
    
    if (t>=fixed_zero) {
      sorter.add(t, m_task_projection->unproject(ray.parametric(t)));
    }
  }
  return sorter.all();
}