Galaxy.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef TRIALDISPLAY_GALAXY_H
00029 #define TRIALDISPLAY_GALAXY_H
00030
00031 #include <casa/aips.h>
00032 #include <casa/Arrays/Vector.h>
00033 #include <casa/Arrays/Matrix.h>
00034 #include <casa/Containers/List.h>
00035
00036 namespace casa {
00037
00038 class PixelCanvas;
00039
00040
00041
00042
00043
00044 class Galaxy {
00045
00046 public:
00047
00048 enum PLOT_MODE {
00049 POSITION,
00050 VELOCITY
00051 };
00052
00053
00054 Galaxy(Vector<Double>& position, Vector<Double>& velocity, Double mass,
00055 Double size, uInt numStars, uInt numRings, Double inclination,
00056 Double positionAngle, Int xSize, Int ySize);
00057
00058
00059 ~Galaxy();
00060
00061
00062
00063 void computeStep(List<void *>& galaxyList, Double timeStep,
00064 Double dampingFactor = 1.0);
00065
00066
00067 void update();
00068
00069
00070 void applyForceToStars(List<void *>& galaxyList, Double timeStep,
00071 Double dampingFactor);
00072
00073
00074 void rotate(Matrix<Double>& rotMatrix);
00075
00076
00077 void draw(PixelCanvas *pixelCanvas);
00078
00079
00080 Double force(Double distance);
00081
00082
00083 Double getMass();
00084
00085
00086 Vector<Double>& getPosition();
00087
00088
00089 Vector<Double>& getVelocity();
00090
00091
00092 void setPlotMode(Galaxy::PLOT_MODE plotMode);
00093
00094 void setScale(Int xSize, Int ySize) ;
00095
00096 private:
00097
00098
00099 Double itsMass;
00100
00101
00102 Double itsSize;
00103
00104
00105 Vector<Double> itsPosition;
00106
00107
00108 Vector<Double> itsVelocity;
00109
00110
00111
00112 Vector<Double> newPosition;
00113
00114
00115 Vector<Double> newVelocity;
00116
00117
00118 List<void *> itsStarList;
00119
00120
00121 ListIter<void *> *itsStarListIter;
00122
00123 Vector<Int> oldPosition;
00124
00125 Vector<Int> itsOffset;
00126
00127 Vector<Int> itsPlotPosition;
00128
00129 Int itsXSize;
00130 Int itsYSize;
00131
00132
00133 uInt itsDrawList;
00134
00135 PixelCanvas *itsPixelCanvas;
00136
00137 Galaxy::PLOT_MODE plotMode;
00138
00139 Bool changedPlotMode;
00140 };
00141
00142
00143
00144
00145
00146 class Star {
00147
00148 public:
00149
00150
00151 Star(Vector<Double>& position, Vector<Double>& velocity,
00152 Int xSize, Int ySize);
00153
00154
00155 ~Star();
00156
00157
00158 void draw(PixelCanvas *pixelCanvas);
00159
00160
00161 void applyForce(List<void *>& galaxyList, Double timeStep,
00162 Double dampingFactor);
00163
00164
00165 void rotate(Matrix<Double>& rotMatrix);
00166
00167
00168 void setPlotMode(Galaxy::PLOT_MODE newPlotMode);
00169
00170 void setScale(Int xSize, Int ySize) ;
00171
00172 private:
00173
00174
00175 Vector<Double> itsPosition;
00176
00177 Vector<Int> oldPosition;
00178
00179 Vector<Int> itsOffset;
00180
00181 Vector<Int> itsPlotPosition;
00182
00183
00184 Vector<Double> itsVelocity;
00185
00186 Int itsXSize;
00187 Int itsYSize;
00188
00189
00190 uInt itsDrawList;
00191
00192
00193 PixelCanvas *itsPixelCanvas;
00194
00195 Galaxy::PLOT_MODE plotMode;
00196
00197 Bool changedPlotMode;
00198 };
00199
00200
00201 }
00202
00203 #endif