예제 #1
0
FlatPoint
FlatProjection::ProjectFloat(const GeoPoint &tp) const
{
    assert(IsValid());

    return FlatPoint((tp.longitude - center.longitude)
                     .AsDelta().Native() * cos,
                     (tp.latitude - center.latitude)
                     .AsDelta().Native() * fixed_scale);
}
예제 #2
0
FlatPoint
TaskProjection::fproject(const GeoPoint& tp) const
{
  assert(initialised);

  return FlatPoint((tp.Longitude - location_mid.Longitude)
                   .as_delta().value_native() * cos_midloc,
                   (tp.Latitude - location_mid.Latitude)
                   .as_delta().value_native() * fixed_scale);
}
예제 #3
0
/**
 * Convert a #LeastSquares to a #WaveInfo.  Returns
 * WaveInfo::Undefined() if there is no valid result in the
 * #LeastSquares instance.
 */
gcc_pure
static WaveInfo
GetWaveInfo(const LeastSquares &ls, const FlatProjection &projection,
            double time)
{
  if (!ls.HasResult())
    return WaveInfo::Undefined();

  const FlatPoint flat_location(ls.GetMiddleX(), ls.GetAverageY());
  const GeoPoint location(projection.Unproject(flat_location));

  const GeoPoint a(projection.Unproject(FlatPoint(ls.GetMinX(),
                                                  ls.GetYAtMinX())));
  const GeoPoint b(projection.Unproject(FlatPoint(ls.GetMaxX(),
                                                  ls.GetYAtMaxX())));

  Angle bearing = a.Bearing(b);
  Angle normal = (bearing + Angle::QuarterCircle()).AsBearing();

  return {location, a, b, normal, time};
}
예제 #4
0
bool
FlatEllipse::intersect_extended(const FlatPoint &pe, FlatPoint &i1,
                                FlatPoint &i2) const
{
  const FlatLine l_f1p(f1, pe);
  const FlatLine l_pf2(pe, f2);
  const Angle ang = l_f1p.angle();

  const fixed d = l_pf2.d() + max(a, b); // max line length

  fixed can, san;
  ang.sin_cos(san, can);

  FlatLine e_l(pe, FlatPoint(pe.x + d * can, pe.y + d * san));
  // e_l is the line extended from p in direction of f1-p 
  
  return intersect(e_l, i1, i2);
}
예제 #5
0
bool
FlatEllipse::IntersectExtended(const FlatPoint &pe, FlatPoint &i1,
                                FlatPoint &i2) const
{
  const FlatLine l_f1p(f1, pe);
  const FlatLine l_pf2(pe, f2);
  const Angle ang = l_f1p.angle();

  const fixed d = l_pf2.d() + std::max(a, b); // max line length

  const auto sc = ang.SinCos();
  fixed san = sc.first, can = sc.second;

  FlatLine e_l(pe, FlatPoint(pe.x + d * can, pe.y + d * san));
  // e_l is the line extended from p in direction of f1-p 
  
  return Intersect(e_l, i1, i2);
}
예제 #6
0
 constexpr
 FlatPoint Half() const {
   return FlatPoint(::Half(x), ::Half(y));
 }
예제 #7
0
 gcc_constexpr_method
 FlatPoint Half() const {
   return FlatPoint(::half(x), ::half(y));
 }
예제 #8
0
파일: FlatPoint.hpp 프로젝트: Advi42/XCSoar
 constexpr
 FlatPoint Half() const {
   return FlatPoint(x / 2, y / 2);
 }