#include <galaxy.h>
Inheritance diagram for TGalaxy:
Public Methods | |
TGalaxy (const string &name="", const TPoint &Size=0, bool wrapX=false, bool wrapY=false, bool wrapZ=false) | |
~TGalaxy () | |
bool | addStellarObject (TStellarObject *obj) |
int2 | getDimension () const |
double | getDistance (const TPoint &one, const TPoint &two) const |
double | getDistance (const TStellarObject *one, const TStellarObject *two) const |
TPoint | getDistanceVector (const TPoint &from, const TPoint &to) const |
TPoint | getDistanceVector (const TStellarObject *from, const TStellarObject *to) const |
const string & | getName () const |
const TPoint & | getSize () const |
const TStellarObjectList & | getStellarObjectList () const |
int4 | getTotalNumber () const |
virtual int2 | getType () const |
virtual const string & | getTypeName () const |
virtual bool | load (TDataPackageList *in) |
bool | remove (TStellarObject *obj) |
virtual bool | save (TDataPackageList *out) const |
bool | transform (TPoint &point) const |
Private Methods | |
void | removeAll () |
bool | transformCoordinate (double &x, double max, bool wrap) const |
Private Attributes | |
string | fName |
TPoint | fSize |
TStellarObjectList | fStObj |
bool | fWrapX |
bool | fWrapY |
bool | fWrapZ |
Also the galaxy contains the information about the "metric" of the space, that means calculating distances between two points in space is done by the galaxy. Distances will especially depend on the settings for wrapping ("wrapping" is just another word for gluing the borders of a galaxy together).
|
Initializes the galaxy object.
|
|
Removes all stellar objects from the array (and deletes the stellar objects) |
|
Adds a stellar object to the galaxy. Note: after adding a stellar object to a galaxy the galaxy will take care of deleting the object. Note also that this method will not check for duplicate entries, thus you are responsible that this does not happen.
|
|
|
|
Calculates the shortest distance between two stellar objects. The distance is not only a function of the two stellar objects but also of the galaxy settings (e.g. wrap).
|
|
Calculates the shortest distance between two points. The distance is not only a function of the two points but also of the galaxy settings (e.g. wrap).
|
|
Calculates the shortest vector between two stellar objects, taking into account the wrap settings for this galaxy. The result is a vector pointing from 'pFrom' to 'pTo'.
|
|
Calculates the shortest vector between two points, taking into account the wrap settings for this galaxy.
|
|
|
|
|
|
Access the list of the stellar objects present in the galaxy.
|
|
|
|
Reimplemented from TLinkable. |
|
Returns the name of this class: "TGalaxy".
Reimplemented from TLinkable. |
|
Loads a TGalaxy object. Note that this method will not load any stellar objects. The galaxy will add itself automatically to the universe.
Reimplemented from TLinkable. |
|
Removes a stellar object from the galaxy. The method does not only remove the pointer to the object but also deletes the stellar object.
|
|
Removes all stellar objects from the galaxy. |
|
Saves a TGalaxy object by adding the data packages to the list. Note that this method will not save the stellar objects.
Reimplemented from TLinkable. |
|
Transforms the coordinates so that the point is within the galaxy. In case the wrapping for a axis is on, the method will perform a "modulo" operation. If for example the x size of the galaxy is 3.0 (wrap active) and the x-component of the argument is 4.7 the method will change this to 1.7. If the wrapping is swichted off the result for this component would be 3.0 which is in the box.
|
|
The same as transformPoint just for a single coordinate.
|
|
Name of this galaxy. |
|
The size of the galaxy. |
|
A list of stellar objects in this galaxy |
|
Wrap setting for the x-axis. |
|
Wrap setting for the y-axis. |
|
Wrap setting for the z-axis. |