Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members

UtilityFactory.H

Go to the documentation of this file.
00001 
00010 #ifndef UTILITYFACTORY_H
00011 #define UTILITYFACTORY_H
00012 
00013 // Gluebase includes
00014 #define OUTSIDE_GLUE_CORE
00015 #include <mlib/points.H>
00016 #include <std/hash.H>
00017 #include <std/strings.H>
00018 
00019 #include "Interpolator.H"
00020 
00021 namespace InSpace {
00022 
00023 #define TWOPI (M_PI*2)
00024 
00025 class UTILITYFACTORY{
00026 public:
00027   static Interpolator* getLinearInterpolator(){
00028     if (!_interpolator){
00029       _interpolator=new LinearInterpolator();
00030     }
00031     return _interpolator;
00032   }
00033 
00034   static Wpt_list& getCircle(){
00035     if (_baseRing.num()==0){
00036       int nfaces = CONFIGval("TUBE_NFACES",8,false);
00037       for (double angle=0; angle<TWOPI; angle += TWOPI/(double)nfaces) {
00038     _baseRing += Wpt(cos(angle),0,sin(angle));
00039       }
00040     }
00041     return _baseRing;
00042   }
00043   
00044   static double* getCircleTexCoord(){
00045     if (!_texcoord){
00046       int nfaces = CONFIGval("TUBE_NFACES",8,false);
00047       _texcoord=new double[nfaces];
00048       int count=0;
00049       for (double angle=0; angle<TWOPI; angle += TWOPI/(double)nfaces) {
00050     _texcoord[count++]=(sin(angle)+1.0)/2.0;
00051       }
00052     }
00053     return _texcoord;
00054   }
00055 protected:
00056   static Wpt_list _baseRing;
00057   static Interpolator *_interpolator;
00058   static double* _texcoord;
00059 };
00060 
00061 }
00062 #endif

Generated on Thu Jul 8 15:19:29 2004 for inspace by doxygen 1.3.4