Beispiel #1
0
void lla_of_ecef_i(struct LlaCoor_i *out, struct EcefCoor_i *in)
{

#if USE_SINGLE_PRECISION_LLA_ECEF
  /* convert our input to floating point */
  struct EcefCoor_f in_f;
  in_f.x = M_OF_CM((float)in->x);
  in_f.y = M_OF_CM((float)in->y);
  in_f.z = M_OF_CM((float)in->z);
  /* calls the floating point transformation */
  struct LlaCoor_f out_f;
  lla_of_ecef_f(&out_f, &in_f);
  /* convert the output to fixed point       */
  out->lon = (int32_t)rint(EM7DEG_OF_RAD(out_f.lon));
  out->lat = (int32_t)rint(EM7DEG_OF_RAD(out_f.lat));
  out->alt = (int32_t)MM_OF_M(out_f.alt);
#else // use double precision by default
  /* convert our input to floating point */
  struct EcefCoor_d in_d;
  in_d.x = M_OF_CM((double)in->x);
  in_d.y = M_OF_CM((double)in->y);
  in_d.z = M_OF_CM((double)in->z);
  /* calls the floating point transformation */
  struct LlaCoor_d out_d;
  lla_of_ecef_d(&out_d, &in_d);
  /* convert the output to fixed point       */
  out->lon = (int32_t)rint(EM7DEG_OF_RAD(out_d.lon));
  out->lat = (int32_t)rint(EM7DEG_OF_RAD(out_d.lat));
  out->alt = (int32_t)MM_OF_M(out_d.alt);
#endif

}
void lla_of_ecef_i(struct LlaCoor_i* out, struct EcefCoor_i* in)
{

  /* convert our input to floating point */
  struct EcefCoor_d in_d;
  in_d.x = M_OF_CM((double)in->x);
  in_d.y = M_OF_CM((double)in->y);
  in_d.z = M_OF_CM((double)in->z);
  /* calls the floating point transformation */
  struct LlaCoor_d out_d;
  lla_of_ecef_d(&out_d, &in_d);
  /* convert the output to fixed point       */
  out->lon = (int32_t)rint(EM7DEG_OF_RAD(out_d.lon));
  out->lat = (int32_t)rint(EM7DEG_OF_RAD(out_d.lat));
  out->alt = (int32_t)MM_OF_M(out_d.alt);

}