Open PaperOpt
OpenPaperOpt/Halftone.h
Go to the documentation of this file.
00001 // Halftone.h: interface for the Halftone class.
00002 //
00004 #if !defined(AFX_HALFTONE_H__10167E05_8439_4637_9A44_6AB9D1959D6E__INCLUDED_)
00005 #define AFX_HALFTONE_H__10167E05_8439_4637_9A44_6AB9D1959D6E__INCLUDED_
00006 #if _MSC_VER > 1000
00007 #pragma once
00008 #endif // _MSC_VER > 1000
00009 
00010 #include <fstream>
00011 #include <complex>
00012 #include <valarray>
00013 #include <vector>
00014 #include "WavePacket.h"
00015 #include "ScatteringParameters.h"
00016 #include "HomogeneousScatteringMaterial.h"
00017 
00018 
00019 class Halftone {
00020 
00021         friend class SurfaceTNInk;
00022 
00023 public:
00024         Halftone() {};
00025         //Halftone(SurfaceTNInk* _surf, ifstream& inht, float _zoffset, std::vector<float> lambdasim);
00026 
00027 
00043         Halftone(ScatteringParameters* pScatteringParameters, float zOffset, std::vector<float>& rLambdas,
00044                           float xmin, float xmax, float ymin, float ymax, float screenAngle, float dropletHeight, float dropletWidth,
00045                                 float dropletSpacing);
00046 
00047         virtual ~Halftone();
00048 
00054         void setSurface(SurfaceTNInk* pSurface);
00062         int drop_process(WavePacket& wp, int updown) const;
00063         
00064         double GetZmax() const { return offset+radius; }
00065 
00066 private:
00067 /*******************************************************************************
00068  * DropScatter
00069  *
00070  * Returns the result of a scattering of an ink drop. The drop normal at the
00071  * intersection point must be stored in wp.Snormal, and wp.mPos must refer to
00072  * the boundary of the drop. scatter_case indicates the
00073  * situation:
00074   *******************************************************************************/
00075         int DropScatter(WavePacket& wp, int scatter_case) const;
00076 
00077 /*******************************************************************************
00078  * DropIntercept
00079  *
00080  * A function that returns the distance from a wp to a drop boundary. The wp must
00081  * be placed within the drop, where xp and yp refer to the x- and y-coordinates
00082  * of the centre of the drop. hull_ind should have any of the following values:
00083  *   -1: The wp is placed on the drop-surface contact area.
00084  *    0: The wp is within the drop.
00085  *    1: The wp is placed on the drop hull.
00086  *******************************************************************************/
00087         double DropIntercept(WavePacket& wp, double xp, double yp, int& hull_ind) const;
00088 
00089         SurfaceTNInk* surf;
00090 
00091         float xmin, xmax;               // Min and max of the area covered with droplets
00092         float ymin, ymax;
00093 
00094         double spacing;                                 // Droplet spacing
00095         double screen_angle;            // Screen angle in radians
00096         double transfx[2];                      // Precalc values to transform coordinates
00097         double transfy[2];                      //   to and from the screen coordinate system
00098 
00099         double width;                                           // Droplet width
00100         double height;                                  // Droplet height
00101         double radius;                                  // Droplet radius
00102         double radius2;                                 //   ...squared
00103         double offset;                                  // The z-value of the sphere centre corresponding to the droplets
00104         double offset2;                                 //    ...squared
00105         double surface_radius2; // Half the width squared
00106 
00107 
00112         HomogeneousScatteringMaterial* mHomogeneousScatteringMaterial;
00113 
00114         vector<double> mSca;
00115         vector<double> mAbs;
00116         vector<complex_LC> mpRefrIndex;
00117 
00118 
00119 protected:
00120 
00121         void WriteInfo(int nbr);
00122 
00123 };
00124 
00125 const double MAX_DropScatter_LOOPS = 1000; // Max no of allowed scattering
00126                                                                                                                                                                                 // events within a droplet.
00127 
00128 #endif // !defined(AFX_HALFTONE_H__10167E05_8439_4637_9A44_6AB9D1959D6E__INCLUDED_)