Comet.hpp   Comet.hpp 
/* /*
* Stellarium * Stellarium
* Copyright (C) 2010 Bogdan Marinov * Copyright (C) 2010 Bogdan Marinov
* Copyright (C) 2014 Georg Zotti (orbit fix, tails, speedup)
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2 * as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version. * of the License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
skipping to change at line 31 skipping to change at line 32
#define _COMET_HPP_ #define _COMET_HPP_
#include "Planet.hpp" #include "Planet.hpp"
/*! \class Comet /*! \class Comet
\author Bogdan Marinov, Georg Zotti (orbit computation enhancements, tails) \author Bogdan Marinov, Georg Zotti (orbit computation enhancements, tails)
Some of the code in this class is re-used from the parent Planet cla ss. Some of the code in this class is re-used from the parent Planet cla ss.
\todo Implement better comet rendering (star-like objects, no physic al body). \todo Implement better comet rendering (star-like objects, no physic al body).
\todo (Long-term) Photo realistic comet rendering, see https://bluep rints.launchpad.net/stellarium/+spec/realistic-comet-rendering \todo (Long-term) Photo realistic comet rendering, see https://bluep rints.launchpad.net/stellarium/+spec/realistic-comet-rendering
2013-12: New algorithms for position computation following Paul Heaf 2013-12: GZ: New algorithms for position computation following Paul
ner: Fundamental Ephemeris Computations (Willmann-Bell 1999). Heafner: Fundamental Ephemeris Computations (Willmann-Bell 1999).
2014-01: Parabolic tails appropriately scaled/rotated. Much is curre 2014-01: GZ: Parabolic tails appropriately scaled/rotated. Much is c
ntly empirical, leaving room for physics-based improvements. urrently empirical, leaving room for physics-based improvements.
2014-08: GZ: speedup in case hundreds of comets are loaded.
*/ */
class Comet : public Planet class Comet : public Planet
{ {
public: public:
friend class SolarSystem; // Solar System initializes static constants.
Comet(const QString& englishName, Comet(const QString& englishName,
int flagLighting, int flagLighting,
double radius, double radius,
double oblateness, double oblateness,
Vec3f color, Vec3f color,
float albedo, float albedo,
const QString& texMapName, const QString& texMapName,
posFuncType _coordFunc, posFuncType _coordFunc,
void* userDataPtr, void* userDataPtr,
OsculatingFunctType *osculatingFunc, OsculatingFunctType *osculatingFunc,
bool closeOrbit, bool closeOrbit,
bool hidden, bool hidden,
const QString &pType, const QString &pTypeStr,
float dustTailWidthFact=1.5f, float dustTailWidthFact=1.5f,
float dustTailLengthFact=0.4f, float dustTailLengthFact=0.4f,
float dustTailBrightnessFact=1.5f float dustTailBrightnessFact=1.5f
); );
virtual ~Comet(); virtual ~Comet();
//Inherited from StelObject via Planet //Inherited from StelObject via Planet
//! Get a string with data about the Comet. //! Get a string with data about the Comet.
//! Comets support the following InfoStringGroup flags: //! Comets support the following InfoStringGroup flags:
//! - Name //! - Name
//! - Magnitude //! - Magnitude
//! - RaDec //! - RaDec
//! - AltAzi //! - AltAzi
skipping to change at line 90 skipping to change at line 93
//! different distances from the Sun. They are not used in the same way //! different distances from the Sun. They are not used in the same way
//! as the same parameters in MinorPlanet. //! as the same parameters in MinorPlanet.
void setAbsoluteMagnitudeAndSlope(const double magnitude, const doub le slope); void setAbsoluteMagnitudeAndSlope(const double magnitude, const doub le slope);
//! set value for semi-major axis in AU //! set value for semi-major axis in AU
void setSemiMajorAxis(const double value); void setSemiMajorAxis(const double value);
//! get sidereal period for comet, days, or returns 0 if not possibl e (paraboloid, hyperboloid orbit) //! get sidereal period for comet, days, or returns 0 if not possibl e (paraboloid, hyperboloid orbit)
virtual double getSiderealPeriod() const; virtual double getSiderealPeriod() const;
//! GZ: override from Planet: extend with tail details.
virtual void computePosition(const double date);
//! re-implementation of Planet's draw() //! re-implementation of Planet's draw()
virtual void draw(StelCore* core, float maxMagLabels, const QFont& p lanetNameFont); virtual void draw(StelCore* core, float maxMagLabels, const QFont& p lanetNameFont);
private: private:
//! @returns estimates for (Coma diameter [AU], gas tail length [AU] ). //! @returns estimates for (Coma diameter [AU], gas tail length [AU] ).
//! Using the formula from Guide found by the GSoC2012 initiative at http://www.projectpluto.com/update7b.htm#comet_tail_formula //! Using the formula from Guide found by the GSoC2012 initiative at http://www.projectpluto.com/update7b.htm#comet_tail_formula
Vec2f getComaDiameterAndTailLengthAU() const; Vec2f getComaDiameterAndTailLengthAU();
void drawTail(StelCore* core, StelProjector::ModelViewTranformP tran sfo, bool gas); void drawTail(StelCore* core, StelProjector::ModelViewTranformP tran sfo, bool gas);
void drawComa(StelCore* core, StelProjector::ModelViewTranformP tran sfo); void drawComa(StelCore* core, StelProjector::ModelViewTranformP tran sfo);
//! compute a coma, faked as simple disk to be tilted towards the ob server. //! compute a coma, faked as simple disk to be tilted towards the ob server.
//! @param diameter Diameter of Coma [AU] //! @param diameter Diameter of Coma [AU]
void computeComa(const float diameter); void computeComa(const float diameter);
//! compute tail shape. This is a paraboloid shell with triangular m esh (indexed vertices). //! compute tail shape. This is a paraboloid shell with triangular m esh (indexed vertices).
//! Try to call not for every frame... //! Try to call not for every frame...
//! To be more efficient, the arrays are only computed if they are e mpty. //! To be more efficient, the arrays are only computed if they are e mpty.
skipping to change at line 123 skipping to change at line 129
//! @param xOffset for the dust tail, this may introduce a bend. Uni ts are x per sqrt(z). //! @param xOffset for the dust tail, this may introduce a bend. Uni ts are x per sqrt(z).
void computeParabola(const float parameter, const float topradius, c onst float zshift, QVector<double>& vertexArr, QVector<float>& texCoordArr, QVector<unsigned short>& indices, const float xOffset=0.0f); void computeParabola(const float parameter, const float topradius, c onst float zshift, QVector<double>& vertexArr, QVector<float>& texCoordArr, QVector<unsigned short>& indices, const float xOffset=0.0f);
double absoluteMagnitude; double absoluteMagnitude;
double slopeParameter; double slopeParameter;
double semiMajorAxis; double semiMajorAxis;
bool isCometFragment; bool isCometFragment;
bool nameIsProvisionalDesignation; bool nameIsProvisionalDesignation;
//GZ Tail additions //GZ Tail additions
Vec2f tailFactors; // result of latest call to getComaDiameterAndTai
lLengthAU(); Results cached here for infostring. [0]=Coma diameter, [1] gas
tail length.
bool tailActive; //! true if there is a tail worth bo
thering (longer than COMET_MIN_TAIL_LENGTH_AU)? Drawing tails is quite cost
ly.
double deltaJDtail; //! like deltaJD, but time differenc
e between tail geometry updates.
double lastJDtail; //! like lastJD, but time of last tai
l geometry update.
Mat4d gasTailRot; //! rotation matrix for gas tail par
abola
Mat4d dustTailRot; //! rotation matrix for the skewed d
ust tail parabola
float dustTailWidthFactor; //!< empirical individual broadening of the dust tail end, compared to the gas tail end. Actually, dust tail wi dth=2*comaWidth*dustTailWidthFactor. Default 1.5 float dustTailWidthFactor; //!< empirical individual broadening of the dust tail end, compared to the gas tail end. Actually, dust tail wi dth=2*comaWidth*dustTailWidthFactor. Default 1.5
float dustTailLengthFactor; //!< empirical individual length of dust tail relative to gas tail. Taken from ssystem.ini, typical value 0.3.. 0.5, default 0.4 float dustTailLengthFactor; //!< empirical individual length of dust tail relative to gas tail. Taken from ssystem.ini, typical value 0.3.. 0.5, default 0.4
float dustTailBrightnessFactor; //!< empirical individual brightness of dust tail relative to gas tail. Taken from ssystem.ini, default 1.5 float dustTailBrightnessFactor; //!< empirical individual brightness of dust tail relative to gas tail. Taken from ssystem.ini, default 1.5
QVector<double> comaVertexArr;
QVector<float> comaTexCoordArr; // --> 2014-08: could also be decla
red static, but it is filled by StelPainter...
// These are to avoid having index arrays for each comet when all ar
e equal.
static bool createTailIndices;
static bool createTailTextureCoords;
QVector<double> gastailVertexArr; // computed frequently, describes parabolic shape (along z axis) of gas tail. QVector<double> gastailVertexArr; // computed frequently, describes parabolic shape (along z axis) of gas tail.
QVector<double> dusttailVertexArr; // computed frequently, describes parabolic shape (along z axis) of dust tail. QVector<double> dusttailVertexArr; // computed frequently, describes parabolic shape (along z axis) of dust tail.
QVector<float> gastailTexCoordArr; // computed only once per comet! static QVector<float> tailTexCoordArr; // computed only once for all
//QVector<float> dusttailTexCoordArr; // currently identical to gast comets!
ailVertexArr, has been taken out. static QVector<unsigned short> tailIndices; // computed only once fo
QVector<unsigned short> gastailIndices; // computed only once per co r all comets!
met! static StelTextureSP comaTexture;
//QVector<unsigned short> dusttailIndices; // actually no longer req static StelTextureSP tailTexture; // it seems not really necess
uired. Re-use gas tail indices. ary to have different textures. gas tail is just painted blue.
QVector<double> comaVertexArr;
QVector<float> comaTexCoordArr;
StelTextureSP comaTexture;
StelTextureSP gasTailTexture;
//StelTextureSP dusttailTexture; // it seems not really necessary t
o have different textures.
}; };
#endif //_COMET_HPP_ #endif //_COMET_HPP_
 End of changes. 9 change blocks. 
34 lines changed or deleted 57 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/