Esempio n. 1
0
ShapePoint
XShape::geo_to_shape(const GeoPoint &origin, const GeoPoint &point) const
{
  const GeoPoint d = point-origin;

  ShapePoint pt;
  pt.x = (ShapeScalar)fast_mult(point.latitude.fastcosine(),
                                fast_mult(d.longitude.Radians(),
                                          fixed_earth_r, 12), 16);
  pt.y = (ShapeScalar)-fast_mult(d.latitude.Radians(), fixed_earth_r, 12);
  return pt;
}
Esempio n. 2
0
ShapePoint
XShape::geo_to_shape(const GeoPoint &origin, const GeoPoint &point) const
{
  const GeoPoint d = point-origin;

  ShapePoint pt;
  pt.x = (ShapeScalar)fast_mult(point.latitude.fastcosine(),
                                AngleToEarthDistance(d.longitude), 16);
  pt.y = (ShapeScalar)-AngleToEarthDistance(d.latitude);
  return pt;
}
Esempio n. 3
0
RasterPoint
Projection::GeoToScreen(const GeoPoint &g) const
{
  const GeoPoint d = GeoLocation-g;
  const FastIntegerRotation::Pair p =
    ScreenRotation.Rotate((int)fast_mult(g.Latitude.fastcosine(),
                                         AngleToPixels(d.Longitude), 16),
                          (int)AngleToPixels(d.Latitude));

  RasterPoint sc;
  sc.x = ScreenOrigin.x - p.first;
  sc.y = ScreenOrigin.y + p.second;
  return sc;
}
Esempio n. 4
0
 /**
  * Convert a an angle on Earth's surface to a pixel distance.
  */
 gcc_pure
 fixed AngleToPixels(Angle angle) const {
   return fast_mult(angle.Radians(), draw_scale, 12);
 }
Esempio n. 5
0
gcc_const
static inline int
NATIVE_TO_INT_COS(fixed x)
{
  return (iround(fast_mult(INT_ANGLE_MULT, 8, x, 2)) + 1024) & 0xfff;
}
Esempio n. 6
0
/**
 * Multiply two very small values (less than 4).  This is an optimised
 * fast path for fixed-point.
 */
constexpr
static inline fixed
SmallMult(fixed a, fixed b)
{
  return fast_mult(a, b, 0);
}