Advertisement
Guest User

AA.cpp

a guest
Oct 21st, 2015
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.28 KB | None | 0 0
  1. #include "stdafx.h"
  2. #include "aaplus\AA+.h"
  3.  
  4. typedef CAAElliptical *EllipticalHandle;
  5.  
  6. // define a macro for the calling convention and export type
  7. #define EXPORTCALL /*__declspec(dllexport)*/ __stdcall
  8.  
  9. struct ObjectElem
  10. {
  11.     double a;
  12.     double e;
  13.     double i;
  14.     double w;
  15.     double omega;
  16.     double JDEquinox;
  17.     double T;
  18. };
  19.  
  20. struct ObjectDetails
  21. {
  22.     double CoordinateEquatorial[3];
  23.     double CoordinateEcliptical[3];
  24.     double elments[12];
  25.     /*
  26.         0   HeliocentricEclipticLongitude;
  27.         1   HeliocentricEclipticLatitude;
  28.         2   TrueGeocentricRA;
  29.         3   TrueGeocentricDeclination;
  30.         4   TrueGeocentricDistance; +
  31.         5   TrueGeocentricLightTime;
  32.         6   AstrometricGeocentricRA;
  33.         7   AstrometricGeocentricDeclination;
  34.         8   AstrometricGeocentricDistance;
  35.         9   AstrometricGeocentricLightTime;
  36.         10  Elongation;
  37.         11  PhaseAngle;
  38.     */
  39. };
  40.  
  41. extern "C"
  42. {
  43.  
  44.     ObjectDetails EXPORTCALL EllipticalCalculate(EllipticalHandle handle,
  45.         double JD, ObjectElem elements, bool bHighPrecision)
  46.     {
  47.         CAAEllipticalObjectElements CAAObjectElem;
  48.         CAAObjectElem.a = elements.a;
  49.         CAAObjectElem.e = elements.e;
  50.         CAAObjectElem.i = elements.i;
  51.         CAAObjectElem.w = elements.w;
  52.         CAAObjectElem.omega = elements.omega;
  53.         CAAObjectElem.JDEquinox = elements.JDEquinox;
  54.         CAAObjectElem.T = elements.T;
  55.  
  56.         CAAEllipticalObjectDetails ResTemp;
  57.         ResTemp = CAAElliptical::Calculate(JD, CAAObjectElem, bHighPrecision);
  58.  
  59.         ObjectDetails Res;
  60.         Res.CoordinateEquatorial[0] = ResTemp.HeliocentricRectangularEquatorial.X;
  61.         Res.CoordinateEquatorial[1] = ResTemp.HeliocentricRectangularEquatorial.Y;
  62.         Res.CoordinateEquatorial[2] = ResTemp.HeliocentricRectangularEquatorial.Z;
  63.  
  64.         Res.CoordinateEcliptical[0] = ResTemp.HeliocentricRectangularEcliptical.X;
  65.         Res.CoordinateEcliptical[1] = ResTemp.HeliocentricRectangularEcliptical.Y;
  66.         Res.CoordinateEcliptical[2] = ResTemp.HeliocentricRectangularEcliptical.Z;
  67.  
  68.         Res.elments[4] = ResTemp.TrueGeocentricDistance;
  69.  
  70.         return Res;
  71.  
  72.     }
  73.  
  74. } // extern "C"
  75.  
  76. /*
  77.     CAAEllipticalObjectElements elements;
  78.     elements.a = 2.2091404;
  79.     elements.e = 0.8502196;
  80.     elements.i = 11.94524;
  81.     elements.omega = 334.75006;
  82.     elements.w = 186.23352;
  83.     elements.T = 2448192.5 + 0.54502;
  84.     elements.JDEquinox = 2451544.5;
  85.     CAAEllipticalObjectDetails details = CAAElliptical::Calculate(2448170.5, elements, false);
  86. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement