Open PaperOpt
OpenPaperOpt/SurfaceTNSubflat.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 _SurfaceTNSubflat_H_
00008 #define _SurfaceTNSubflat_H_
00009 
00010 #if _MSC_VER > 1000
00011 #pragma once
00012 #endif
00013 
00014 #define MIN(a, b)  (((a) < (b)) ? (a) : (b))
00015 #define MAX(a, b)  (((a) > (b)) ? (a) : (b))
00016 #define ABS(a)     (((a) < 0) ? -(a) : (a))
00017 
00018 #include "SurfaceTN.h"
00019 #include "Array2D.h"
00020 
00021 class SurfaceTNSubflat : public SurfaceTN {
00022 
00023 public:
00024 
00045         SurfaceTNSubflat(float _zoffset, float sizeX, float sizeY, Array2D<float>,
00046                                                                                                                  int _normfact, bool _interpolate, float _rmsmin,
00047                                                                                                                  float _rmsmax, StructureObject* _el);
00062         SurfaceTNSubflat(float _zoffset, float sizeX, float sizeY, Array2D<float>& z,
00063                                                                                                                  int _normfact, bool _interpolate, Array2D< V2<float> >& v, StructureObject* _el);
00064         /*******************************************************************************
00065         * CONSTRUCTOR
00066         *
00067         * Similar to the constructor in SurfaceTN, but with a topography file specified
00068         * as well as normals from topography file and roughnes is replaced by Vector Template.
00069         *@param _zoffset                        Indicates actualy where is surface actualy exists      
00070         *@param sizeX                                   Size of normal
00071         *@param sizeY                                   Size of normal
00072         *@param z                                               Instance Array2D vector to handle row and columns and to read topography 
00073         *@param _normfact                           Represents how many normal can be calculated
00074         *@param _interpolate                    Resolution of generated surface normal map.
00075         *@param v                                               Replacement of roughness
00076         *@param _el                                             Instance of StructureObject class is used to appraoch next surface layer untill
00077                                                                         last one
00078  *******************************************************************************/
00079         SurfaceTNSubflat(float _zoffset, float sizeX, float sizeY, Array2D<float>& z,
00080                                                                                                                  int _mNorm, int _nnorm, std::string _normfile, bool _interpolate,
00081                                                                                                                  Array2D< V2<float> >& v, StructureObject* _el);
00082 
00083         /*******************************************************************************
00084         * CONSTRUCTOR
00085         *
00086         * Will create a surface where only the orthogonal normals of the topography are
00087         * used and NOT any normal mapping.
00102         SurfaceTNSubflat(float _zoffset, float sizeX, float sizeY, Array2D<float>,
00103                                                                                                                                                  float _rmsmin, float _rmsmax, StructureObject* _el);
00104 
00110         virtual ~SurfaceTNSubflat();
00120         int mIntercept(WavePacket& wp, double t1in, double t2in,
00121                                                                                                         int updown, double& t) const;
00126         double mZposition(WavePacket &wp) const;
00127 
00128 
00129 private:
00130 
00131         bool ReadTopography(std::string topofile);
00132         void WriteInfo(bool topobased, std::string _topofile,
00133                                                                         std::string _normfile, std::string _roughfile);
00134 
00135         int mtopo, ntopo;                       // The size of the topography grid
00136         float dxtopo, dytopo;   // The distance between grid points
00137         float* x;                                                       // The x-values of the grid
00138         float* y;                                                       // The y-values of the grid
00139         Array2D<float> z;                       // The topography grid
00140 };
00141 
00142 #endif