30 int letterToNum(QChar c)
33 if( l < 'A' || l >
'Z' || l ==
'I')
40 int letterDesigToN(QString s) {
43 int nl = letterToNum(c);
51 QMap<QChar,qint64> cometType;
55 long double _JD,
double _q,
double _e,
dms _i,
dms _w,
dms _Node,
double Tp,
float _M1,
56 float _M2,
float _K1,
float _K2)
58 JD(_JD), q(_q), e(_e), M1(_M1), M2(_M2), K1(_K1), K2(_K2), i(_i), w(_w),
N(_Node)
64 int year = int( Tp/10000.0 );
65 int month = int( (
int(Tp) % 10000)/100.0 );
66 int day = int(
int(Tp) % 100 );
67 double Hour = 24.0 * ( Tp - int(Tp) );
69 int m = int( 60.0 * ( Hour - h ) );
70 int s = int( 60.0 * ( 60.0 * ( Hour - h) - m ) );
78 P = 365.2568984 * pow(a, 1.5);
81 if (
name().contains(
"/" ) ) {
92 QRegExp rePer(
"^(\\d+)[PD](-([A-Z]+))?");
93 if( rePer.indexIn(_s) != -1 ) {
95 qint64 num = rePer.cap(1).toInt();
97 qint64 fragmentN = letterDesigToN( rePer.cap(2) );
99 uidPart = num << 16 | fragmentN;
105 QRegExp rePro(
"^([PCXDA])/.*\\((\\d{4}) ([A-Z])(\\d+)(-([A-Z]+))?\\)");
106 if( rePro.indexIn(_s) != -1 ) {
108 if( cometType.empty() ) {
109 cometType.insert(
'P',0);
110 cometType.insert(
'C',1);
111 cometType.insert(
'X',2);
112 cometType.insert(
'D',3);
113 cometType.insert(
'A',4);
115 qint64
type = cometType[ rePro.cap(1)[0] ];
116 qint64 year = rePro.cap(2).toInt();
117 qint64 halfMonth = letterToNum( rePro.cap(3)[0] );
118 qint64 nHalfMonth = rePro.cap(4).toInt();
119 qint64 fragment = letterDesigToN( rePro.cap(6) );
144 NuclearSize = pow( 10, 2.1 - 0.2 * M1 );
145 double mHelio = M1 + K1 * log10(
rsun() );
147 L0 = pow( 10, -0.0075 * mHelio * mHelio - 0.19 * mHelio + 2.10 );
148 D0 = pow( 10, -0.0033 * mHelio * mHelio - 0.07 * mHelio + 3.25 );
149 L = L0 * ( 1 - pow( 10, -4 *
rsun() ) ) * ( 1 - pow( 10, -2 *
rsun() ) );
150 D = D0 * ( 1 - pow( 10, -2 *
rsun() ) ) * ( 1 - pow( 10, -
rsun() ) );
157 double v(0.0), r(0.0);
164 double k = 0.01720209895;
165 double a = 0.75 * ( num->
julianDay() - JDp ) * k * sqrt( (1+e)/(q*q*q) );
166 double b = sqrt( 1.0 + a*a );
167 double W = pow((b+a),1.0/3.0) - pow((b-a),1.0/3.0);
168 double c = 1.0 + 1.0/(W*
W);
169 double f = (1.0-e)/(1.0+e);
172 double a1 = (2.0/3.0) + (2.0*W*W/5.0);
173 double a2 = (7.0/5.0) + (33.0*W*W/35.0) + (37.0*W*W*W*W/175.0);
174 double a3 = W*W*( (432.0/175.0) + (956.0*W*W/1125.0) + (84.0*W*W*W*W/1575.0) );
175 double w = W*(1.0 + g*c*( a1 + a2*g + a3*g*g ));
177 v = 2.0*atan(w) / dms::DegToRad;
178 r = q*( 1.0 + w*w )/( 1.0 + w*w*f );
184 m.SinCos( sinm, cosm );
187 double E = m.
Degrees() + e*180.0/
dms::PI * sinm * ( 1.0 + e*cosm );
195 E = E0 - ( E0 - e*180.0/
dms::PI *sin( E0*dms::DegToRad ) - m.
Degrees() )/(1 - e*cos( E0*dms::DegToRad ) );
196 }
while ( fabs( E - E0 ) > 0.001 && iter < 1000 );
201 E1.SinCos( sinE, cosE );
203 double xv = a * ( cosE - e );
204 double yv = a * sqrt( 1.0 - e*e ) * sinE;
207 v = atan2( yv, xv ) / dms::DegToRad;
208 r = sqrt( xv*xv + yv*yv );
213 double sinN, cosN, sinvw, cosvw, sini, cosi;
215 n.SinCos( sinN, cosN );
216 vw.SinCos( sinvw, cosvw );
217 i.SinCos( sini, cosi );
220 double xh = r * ( cosN * cosvw - sinN * sinvw * cosi );
221 double yh = r * ( sinN * cosvw + cosN * sinvw * cosi );
222 double zh = r * ( sinvw * sini );
225 double ELongRad = atan2( yh, xh );
226 double ELatRad = atan2( zh, r );
233 double cosBe, sinBe, cosLe, sinLe;
234 Earth->
ecLong().SinCos( sinLe, cosLe );
235 Earth->
ecLat().SinCos( sinBe, cosBe );
237 double xe = Earth->
rsun() * cosBe * cosLe;
238 double ye = Earth->
rsun() * cosBe * sinLe;
239 double ze = Earth->
rsun() * sinBe;
247 ELongRad = atan2( yh, xh );
248 double rr = sqrt( xh*xh + yh*yh );
249 ELatRad = atan2( zh, rr );
265 void KSComet::findMagnitude(
const KSNumbers*)
272 EarthMOID = earth_moid;
297 OrbitClass = orbit_class;
312 RotationPeriod = rot_per;
void setRearth(double r)
Set the distance from Earth, in AU.
void findPhysicalParameters()
Estimate physical parameters of the comet such as coma size, tail length and size of the nucleus...
void setDiameter(float diam)
Sets the comet's diameter.
void aberrate(const KSNumbers *num)
Determine the effects of aberration for this SkyPoint.
void nutate(const KSNumbers *num)
Determine the effects of nutation for this SkyPoint.
const double & Degrees() const
void setLongName(const QString &longname=QString())
Set the object's long name.
void setRsun(double r)
Set the solar distance in AU.
void setPeriod(float per)
Sets the comet's period.
void setEarthMOID(double earth_moid)
Sets the comet's earth minimum orbit intersection distance.
void setRotationPeriod(float rot_per)
Sets the comet's rotation period.
void setOrbitClass(QString orbit_class)
Sets the comet's orbit class.
UID solarsysUID(UID type) const
Compute high 32-bits of UID.
static const UID UID_SOL_COMET
Comets.
EclipticPosition helEcPos
A subclass of KSPlanetBase that implements comets.
void setOrbitID(QString orbit_id)
Sets the comet's orbit solution ID.
qint64 UID
Type for Unique object IDenticator.
long double julianDay() const
Extension of KDateTime for KStars KStarsDateTime can represent the date/time as a Julian Day...
const dms * obliquity() const
void EclipticToEquatorial(const dms *Obliquity)
Convert Ecliptic logitude/latitude to Right Ascension/Declination.
An angle, stored as degrees, but expressible in many ways.
void setType(int t)
Set the object's type identifier to the argument.
const dms & ecLat() const
virtual bool loadData()
Unused virtual function inherited from KSPlanetBase, so it's simply empty here.
void setMag(float m)
Set the object's sorting magnitude.
There are several time-dependent values used in position calculations, that are not specific to an ob...
const dms & ecLong() const
KSComet(const QString &s, const QString &image_file, long double JD, double q, double e, dms i, dms w, dms N, double Tp, float M1, float M2, float K1, float K2)
Constructor.
void setDimensions(QString dim)
Sets the comet's dimensions.
void setAlbedo(float albedo)
Sets the comet's albedo.
void setPhysicalSize(double size)
set the planet's physical size, in km.
virtual KSComet * clone() const
Create copy of object.
A subclass of TrailObject that provides additional information needed for most solar system objects...
void setName(const QString &name)
Set the object's primary name.
virtual QString name(void) const
virtual SkyObject::UID getUID() const
Return UID for object.
virtual bool findGeocentricPosition(const KSNumbers *num, const KSPlanetBase *Earth=NULL)
Calculate the geocentric RA, Dec coordinates of the Comet.
void setNEO(bool neo)
Sets if the comet is a near earth object.