Example #1
0
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;
}
Example #2
0
bool
SearchPointVector::IntersectsWith(const FlatRay &ray) const
{
  for (const_iterator it = begin(); it + 1 != end(); ++it) {
    const FlatRay r_seg(it->get_flatLocation(), (it + 1)->get_flatLocation());

    if (r_seg.intersects_distinct(ray))
      return true;
  }
  return false;
}
Example #3
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();
}
Example #4
0
AirspaceIntersectionVector
AirspacePolygon::Intersects(const GeoPoint &start, const GeoPoint &end,
                            const TaskProjection &projection) const
{
  const FlatRay ray(projection.ProjectInteger(start),
                    projection.ProjectInteger(end));

  AirspaceIntersectSort sorter(start, *this);

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

    const FlatRay r_seg(it->GetFlatLocation(), (it + 1)->GetFlatLocation());
    fixed t = ray.DistinctIntersection(r_seg);
    if (!negative(t))
      sorter.add(t, projection.Unproject(ray.Parametric(t)));
  }

  return sorter.all();
}
Example #5
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();
}