7#include "greatcircle.h"
9#include "kstars_debug.h"
12#include "skyqpainter.h"
13#include "projections/projector.h"
22double d2r(
double degrees)
24 return degrees * 2.0 * M_PI / 360.0;
27double r2d(
double radians)
29 return (radians * 360.0 / (2 * M_PI));
45 const double daz = az2 - az1;
46 const double alpha1 = atan2((cos(alt2) * sin(daz)),
47 (cos(alt1) * sin(alt2) - (sin(alt1) * cos(alt2) * cos(daz))));
49 const double term1 = cos(alt1) * sin(alt2) - (sin(alt1) * cos(alt2) * cos(daz));
50 const double term2 = cos(alt2) * sin(daz);
51 const double sigma12 = atan2(sqrt( term1 * term1 + term2 * term2),
52 (sin(alt1) * sin(alt2) + (cos(alt1) * cos(alt2) * cos(daz))));
54 const double term3 = cos(alpha1);
55 const double term4 = sin(alpha1);
56 const double term5 = sin(alt1);
57 alpha0 = atan2((sin(alpha1) * cos(alt1)),
58 sqrt(term3 * term3 + term4 * term4 * term5 * term5));
60 if ((alt1 == 0) && (alpha1 == 0.5 * M_PI))
63 sigma01 = atan2(tan(alt1), cos(alpha1));
65 sigma02 = sigma01 + sigma12;
67 const double lambda01 = atan2(sin(alpha0) * sin(sigma01), cos(sigma01));
69 lambda0 = az1 - lambda01;
71 cosAlpha0 = cos(alpha0);
72 sinAlpha0 = sin(alpha0);
77 double sigma = (1 - fraction) * sigma01 + fraction * sigma02;
78 double cosSigma = cos(sigma);
79 double sinSigma = sin(sigma);
82 (cosAlpha0 * sinSigma),
83 (sqrt(cosSigma * cosSigma + sinAlpha0 * sinAlpha0 * sinSigma * sinSigma))));
85 double LL0 = atan2((sinAlpha0 * sinSigma), cosSigma);
87 *az = r2d(LL0 + lambda0);
90double GreatCircle::altAtAz(
double azDegrees)
const
92 double az = d2r(azDegrees);
93 double alt = atan2(sin(az - lambda0), tan(alpha0));
GreatCircle(double az1, double alt1, double az2, double alt2)
Construct a GreatCircle object for a path between az1,alt1 to az2,alt2.
void waypoint(double fraction, double *az, double *alt) const
Return the azimuth and altitude for a waypoint.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 4 2024 16:38:44 by
doxygen 1.12.0 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.