Open PaperOpt
OpenPaperOpt/SurfaceTN.h
Go to the documentation of this file.
00001 /**********************************************************************
00002  * SurfaceTN.h: interface for the SurfaceTN class.
00003  * Members are explained below, other documentation can be found
00004  * in the implementation file.
00005  **********************************************************************/
00006 
00007 #ifndef _SURFACETN_H_
00008 #define _SURFACETN_H_
00009 
00010 #if _MSC_VER > 1000
00011 #pragma once
00012 #endif
00013 
00014 #include "Surface.h"
00015 #include "utilities.h"
00016 #include "Array2D.h"
00017 
00018 
00019 class SurfaceTN : public Surface {
00020 
00021 public:
00036         SurfaceTN(float _zoffset,float sizeX, float sizeY,Array2D<float>& z,
00037                                                                                  int _normfact, bool _interpolate, float _rmsmin, float _rmsmax,
00038                                                                                  StructureObject* _el);
00051         SurfaceTN(float _zoffset,float sizeX, float sizeY, Array2D<float>& z,
00052                                                                                  int _normfact, bool _interpolate, Array2D< V2<float> >& v, StructureObject* _el);
00053         
00054 
00055         SurfaceTN(float _zoffset, float _xmax, float _ymax, Array2D< V3<float> >& v1, bool _interpolate, Array2D< V2<float> >& v, StructureObject* _el);
00060         //Surface Constructors which are called in other classes as overloaded functions
00061 
00062         SurfaceTN(int _normfact,int _interpolate,Array2D< V2<float> >& v);
00063         SurfaceTN(float _zoffset,float sizeX,float sizeY,Array2D<float>& z ,int _normfact,int  _interpolate,float _rmsmin,float _rmsmax,StructureObject* _el);
00064         SurfaceTN(float _zoffset,float sizeX,float sizeY,Array2D<float>& z,int _normfact,int _interpolate,Array2D< V2<float> >& v,StructureObject* _el);
00065 
00066 
00067         virtual ~SurfaceTN() {};
00068 
00077         virtual int mIntercept(WavePacket& wp, double t1in, double t2in,
00078                                                                                                         int updown, double& t) const;
00085         virtual int Process(WavePacket& wp, int updown, int internal) const;
00089         virtual double mZposition(WavePacket &wp) const { return mZoffset; };
00090 
00091 
00092 private:
00093         bool ReadTopography(std::string _topofile, int mtopo, int ntopo, int normfact);
00094 
00095 protected:
00099         SurfaceTN(int _mNorm, int _nnorm, int _mrough, int _nrough) :
00100                                  normals(_mNorm,_nnorm), roughness(_mrough, _nrough) {};
00101 
00102         void FindSnormal(WavePacket& wp, int updown) const;
00103         virtual bool ReadNormals(std::string _normfile);
00104         virtual void CreateRandomNormals(int thetamax);
00105         virtual void CreateNormals(Array2D<float>& z, int mtopo, int ntopo,
00106                                                                                                                         float dxtopo, float dytopo, int normfact);
00107         virtual bool ReadRoughness(std::string roughfile);
00108         virtual void WriteInfo(bool topobased, std::string _topofile,
00109                                                                                                         std::string _normfile, std::string _roughfile);
00110 
00115         const V2<float> FindRoughness(WavePacket& wp) const {
00116                 if (detailed_roughness) {
00117                         return  roughness((int) (wp.mPos.X()/dxrough),
00118                                                                                          (int) (wp.mPos.Y()/dyrough));
00119                 }
00120 
00121 
00122                 return rms;
00123         }
00124 
00125         int mNorm, nnorm;                               // The size of the normal array
00126         double dxnorm, dynorm;                  // The distance between the precalc. normals
00127         bool interpolate;                               // Indicates if normal interp. should be used
00128         Array2D< V3<double> > normals; // The normal array 
00129         bool normal_mapping;            // Indicates if the normal array should be used at all
00130                                                                                                                                                         //   (currently always used by this class, but not
00131                                                                                                                                                         //    always by subclasses)
00132 
00133         int mrough, nrough;                             // The size of the roughness array
00134         double dxrough, dyrough;        // The distance between roughness points
00135         Array2D< V2<float> > roughness;         // The roughness array
00136         bool detailed_roughness;        // Indicates if the roughness array should be used at all
00137 };
00138 
00139 #endif