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
00029
00030
00031
00032 #ifndef VRS_ANALYTICSHAPEGENERATORS_H
00033 #define VRS_ANALYTICSHAPEGENERATORS_H
00034
00035 #include <vrs/vertexattributegenerator.h>
00036 #include <vrs/vector.h>
00037 #include <vrs/matrix.h>
00038
00039 namespace VRS {
00040
00041 class Box;
00042 class Cone;
00043 class Cylinder;
00044 class Disc;
00045 class Hyperboloid;
00046 class Knot;
00047 class Paraboloid;
00048 class Sphere;
00049 class SuperQuad;
00050 class Torus;
00051
00052 class BoxSideGenerator : public VertexAttributeGenerator {
00053 public:
00054 BoxSideGenerator(const Box*, unsigned int nx, unsigned int ny);
00055
00056 virtual Iterator<Vector>* calcVertexData(const ID& vertexDataType);
00057 virtual Matrix getTransform(unsigned int side) const;
00058
00059 private:
00060 const Vector llf_;
00061 const Vector urb_;
00062 const Vector dim_;
00063 };
00064
00065 class ConeGenerator : public VertexAttributeGenerator {
00066 public:
00067 ConeGenerator(const Cone*, unsigned int nx, unsigned int ny);
00068 virtual ~ConeGenerator();
00069
00070 virtual Iterator<Vector>* calcVertexData(const ID& vertexDataType);
00071 virtual Matrix getTransform() const;
00072
00073 private:
00074 double topRadius_;
00075 double bottomRadius_;
00076 double height_;
00077 double theta_;
00078
00079 double da_;
00080 double ds_;
00081 double dt_;
00082 double dr_;
00083 Vector normal_;
00084 Matrix thetaTf_;
00085
00086 double* sin_a_;
00087 double* cos_a_;
00088 };
00089
00090 class CylinderGenerator : public VertexAttributeGenerator {
00091 public:
00092 CylinderGenerator(const Cylinder*, unsigned int nx, unsigned int ny);
00093 virtual ~CylinderGenerator();
00094
00095 virtual Iterator<Vector>* calcVertexData(const ID& vertexDataType);
00096 virtual Matrix getTransform() const;
00097
00098 private:
00099 double theta_;
00100 Vector topPoint_;
00101 Vector bottomPoint_;
00102 double height_;
00103 double da_;
00104 double dy_;
00105 double ds_;
00106 Matrix thetaTf_;
00107
00108 double* sin_a_;
00109 double* cos_a_;
00110 };
00111
00112 class DiscGenerator : public VertexAttributeGenerator {
00113 public:
00114 DiscGenerator(const Disc*, unsigned int nx, unsigned int ny);
00115 virtual ~DiscGenerator();
00116
00117 virtual Iterator<Vector>* calcVertexData(const ID& vertexDataType);
00118 virtual Matrix getTransform() const;
00119
00120 private:
00121 double theta_;
00122 double radius_;
00123 double deltaTheta_;
00124 double deltaR_;
00125 double di_;
00126 double dj_;
00127 Matrix tf_;
00128
00129 double* sin_p_;
00130 double* cos_p_;
00131 };
00132
00133 class HyperboloidGenerator:public VertexAttributeGenerator {
00134 public:
00135 HyperboloidGenerator(const Hyperboloid*, unsigned int nx, unsigned int ny);
00136 virtual ~HyperboloidGenerator();
00137
00138 virtual Iterator<Vector>* calcVertexData(const ID& vertexDataType);
00139
00140 private:
00141 Vector mid_;
00142 double midx_;
00143 double midy_;
00144 double midz_;
00145
00146 double theta_;
00147
00148 double deltaTheta_;
00149 double intervalmin_;
00150 double deltaY_;
00151
00152 double* sin_theta_;
00153 double* cos_theta_;
00154
00155 double di_;
00156 double dj_;
00157 };
00158
00159 class KnotGenerator : public VertexAttributeGenerator {
00160 public:
00161 KnotGenerator(const Knot*, unsigned int nx, unsigned int ny);
00162 virtual ~KnotGenerator();
00163
00164 virtual Iterator<Vector>* calcVertexData(const ID& vertexDataType);
00165
00166 private:
00167 double rc_;
00168 double rt_;
00169 double thick_;
00170 double pn_;
00171 double qn_;
00172
00173 Vector mid_;
00174 double midx_;
00175 double midy_;
00176 double midz_;
00177
00178 double pmin_;
00179 double pmax_;
00180 double theta_;
00181
00182 double deltaPhi_;
00183 double deltaRho_;
00184
00185 double di_;
00186 double dj_;
00187 };
00188
00189 class ParaboloidGenerator : public VertexAttributeGenerator {
00190 public:
00191 ParaboloidGenerator(const Paraboloid*, unsigned int nx, unsigned int ny);
00192 virtual ~ParaboloidGenerator();
00193
00194 virtual Iterator<Vector>* calcVertexData(const ID& vertexDataType);
00195
00196 private:
00197 double top_;
00198 double bottom_;
00199 double radius_;
00200 double k_;
00201 double theta_;
00202
00203 double dt;
00204 double di;
00205 double dj;
00206
00207 double* sin_t_;
00208 double* cos_t_;
00209 };
00210
00211 class SphereGenerator : public VertexAttributeGenerator {
00212 public:
00213 SphereGenerator(const Sphere*, unsigned int nx, unsigned int ny);
00214 virtual ~SphereGenerator();
00215
00216 virtual Iterator<Vector>* calcVertexData(const ID& vertexDataType);
00217 virtual Matrix getTransform() const;
00218
00219 private:
00220 const Vector c_;
00221 const double r_;
00222
00223 const double ymin_;
00224 const double ymax_;
00225 const double theta_;
00226 const double phimin_;
00227 const double phimax_;
00228
00229 const double dphi_;
00230 const double da_;
00231 const double ds_;
00232 const double dt_;
00233
00234 double* sin_a_;
00235 double* cos_a_;
00236 };
00237
00238 class SuperQuadGenerator : public VertexAttributeGenerator {
00239 public:
00240 SuperQuadGenerator(const SuperQuad*, unsigned int nx, unsigned int ny);
00241 virtual ~SuperQuadGenerator();
00242
00243 virtual Iterator<Vector>* calcVertexData(const ID& vertexDataType);
00244
00245 private:
00246 const double a;
00247 const double ns;
00248 const double ew;
00249
00250 const double ds;
00251 const double dt;
00252 const double du;
00253 double dv;
00254
00255 double v0;
00256
00257 double* signpow_sinv;
00258 double* signpow_cosv;
00259 double* inv_signpow_sinv;
00260 double* inv_signpow_cosv;
00261 };
00262
00263 class TorusGenerator : public VertexAttributeGenerator {
00264 public:
00265 TorusGenerator(const Torus*, unsigned int nx, unsigned int ny);
00266 virtual ~TorusGenerator();
00267
00268 virtual Iterator<Vector>* calcVertexData(const ID& vertexDataType);
00269
00270 private:
00271 double rc_;
00272 double rt_;
00273 Vector mid_;
00274 double midx_;
00275 double midy_;
00276 double midz_;
00277
00278 double pmin_;
00279 double pmax_;
00280 double theta_;
00281
00282 double dp_;
00283 double da_;
00284 double di_;
00285 double dj_;
00286
00287 double* sin_p_;
00288 double* cos_p_;
00289 double* sin_a_;
00290 double* cos_a_;
00291 };
00292
00293 }
00294
00295 #endif // VRS_ANALYTICSHAPEGENERATORS_H
00296