Comet.hpp   Comet.hpp 
skipping to change at line 26 skipping to change at line 26
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA. * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.
*/ */
#ifndef _COMET_HPP_ #ifndef _COMET_HPP_
#define _COMET_HPP_ #define _COMET_HPP_
#include "Planet.hpp" #include "Planet.hpp"
/*! \class Comet /*! \class Comet
\author Bogdan Marinov \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
ner: Fundamental Ephemeris Computations (Willmann-Bell 1999).
2014-01: Parabolic tails appropriately scaled/rotated. Much is curre
ntly empirical, leaving room for physics-based improvements.
*/ */
class Comet : public Planet class Comet : public Planet
{ {
public: public:
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 &pType,
float dustTailWidthFact=1.5f,
float dustTailLengthFact=0.4f,
float dustTailBrightnessFact=1.5f
);
~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
//! - Distance //! - Distance
//! - PlainText //! - PlainText
// - Size <- Size of what? // - Size <- Size of what?
//! \param core the StelCore object //! \param core the StelCore object
//! \param flags a set of InfoStringGroup items to include in the re turn value. //! \param flags a set of InfoStringGroup items to include in the re turn value.
//! \return a QString containing an HMTL encoded description of the Comet. //! \return a QString containing an HMTL encoded description of the Comet.
virtual QString getInfoString(const StelCore *core, const InfoString Group &flags) const; virtual QString getInfoString(const StelCore *core, const InfoString Group &flags) const;
//The Comet class inherits the "Planet" type because the SolarSystem class //The Comet class inherits the "Planet" type because the SolarSystem class
//was not designed to handle different types of objects. //was not designed to handle different types of objects.
//virtual QString getType() const {return "Comet";} //virtual QString getType() const {return "Comet";}
//! \todo Find better sources for the g,k system //! \todo Find better sources for the g,k system
virtual float getVMagnitude(const StelCore* core, bool withExtinctio n=false) const; virtual float getVMagnitude(const StelCore* core) const;
//! \brief sets absolute magnitude and slope parameter. //! \brief sets absolute magnitude and slope parameter.
//! These are the parameters in the IAU's two-parameter magnitude sy stem //! These are the parameters in the IAU's two-parameter magnitude sy stem
//! for comets. They are used to calculate the apparent magnitude at //! for comets. They are used to calculate the apparent magnitude at
//! 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(double magnitude, double 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(double value); void setSemiMajorAxis(const double value);
//! get sidereal period for minor planet //! get sidereal period for comet, days, or returns 0 if not possibl
double getSiderealPeriod() const; e (paraboloid, hyperboloid orbit)
virtual double getSiderealPeriod() const;
//! re-implementation of Planet's draw()
virtual void draw(StelCore* core, float maxMagLabels, const QFont& p
lanetNameFont);
private: private:
//! @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
Vec2f getComaDiameterAndTailLengthAU() const;
void drawTail(StelCore* core, StelProjector::ModelViewTranformP tran
sfo, bool gas);
void drawComa(StelCore* core, StelProjector::ModelViewTranformP tran
sfo);
//! compute a coma, faked as simple disk to be tilted towards the ob
server.
//! @param diameter Diameter of Coma [AU]
void computeComa(const float diameter);
//! compute tail shape. This is a paraboloid shell with triangular m
esh (indexed vertices).
//! Try to call not for every frame...
//! To be more efficient, the arrays are only computed if they are e
mpty.
//! @param parameter the parameter p of the parabola. z=r²/2p (r²=x²
+y²)
//! @param lengthfactor The parabola will be lengthened. This shifts
the visible focus, so it must be here.
//! @param vertexArr vertex array, collects x0, y0, z0, x1, y1, z1,
...
//! @param texCoordArr texture coordinates u0, v0, u1, v1, ...
//! @param colorArr vertex colors (if not textured) r0, g0, b0, r1,
g1, b1, ...
//! @param indices into the former arrays (zero-starting), triplets
forming triangles: t0,0, t0,1, t0,2, t1,0, t1,1, t1,2, ...
//! @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);
double absoluteMagnitude; double absoluteMagnitude;
double slopeParameter; double slopeParameter;
double semiMajorAxis; double semiMajorAxis;
bool isCometFragment; bool isCometFragment;
bool nameIsProvisionalDesignation; bool nameIsProvisionalDesignation;
//GZ Tail additions
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 dustTailBrightnessFactor; //!< empirical individual brightness
of dust tail relative to gas tail. Taken from ssystem.ini, default 1.5
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<float> gastailTexCoordArr; // computed only once per comet!
//QVector<float> dusttailTexCoordArr; // currently identical to gast
ailVertexArr, has been taken out.
QVector<unsigned short> gastailIndices; // computed only once per co
met!
//QVector<unsigned short> dusttailIndices; // actually no longer req
uired. Re-use gas tail indices.
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. 11 change blocks. 
9 lines changed or deleted 85 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/