Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound 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 #define TWOPI (M_PI*2)
00021 
00022 class UTILITYFACTORY{
00023 public:
00024   static Interpolator* getLinearInterpolator(){
00025     if (!_interpolator){
00026       _interpolator=new LinearInterpolator();
00027     }
00028     return _interpolator;
00029   }
00030 
00031   static Wpt_list& getCircle(){
00032     if (_baseRing.num()==0){
00033       int nfaces = CONFIGval("TUBE_NFACES",8,false);
00034       for (double angle=0; angle<TWOPI; angle += TWOPI/(double)nfaces) {
00035     _baseRing += Wpt(cos(angle),0,sin(angle));
00036       }
00037     }
00038     return _baseRing;
00039   }
00040   
00041   static double* getCircleTexCoord(){
00042     if (!_texcoord){
00043       int nfaces = CONFIGval("TUBE_NFACES",8,false);
00044       _texcoord=new double[nfaces];
00045       int count=0;
00046       for (double angle=0; angle<TWOPI; angle += TWOPI/(double)nfaces) {
00047     _texcoord[count++]=(sin(angle)+1.0)/2.0;
00048       }
00049     }
00050     return _texcoord;
00051   }
00052 protected:
00053   static Wpt_list _baseRing;
00054   static Interpolator *_interpolator;
00055   static double* _texcoord;
00056 };
00057 #endif

Generated on Mon Sep 15 16:27:56 2003 for inspace by doxygen1.2.18