GOAT (Geometrical optics application tool) 0.1
Loading...
Searching...
No Matches
iray.h
Go to the documentation of this file.
1/***************************************************************************
2 iray.h - description
3 -------------------
4 begin : Fri Oct 15 1999
5 copyright : (C) 1999 by Thomas Weigel
6 email : weigel@lat.ruhr-uni-bochum.de
7 ***************************************************************************/
8
9
10#pragma once
11#include <complex>
12#include "vector.h"
13#include "matrix.h"
14#include "plane.h"
15#include "objectshape.h"
16#include "tubedray.h"
17#include "misc.h"
18#include "raybase.h"
19
20
21
22namespace GOAT
23{
24 namespace raytracing
25 {
32
33 class IRay : public RayBase {
34 public:
49 const maths::Vector<std::complex<double> >& Pol, const maths::Vector<double>& K,
50 std::complex<double> n0, double r0, double k0,
51 const int numObj = 0, std::vector<ObjectShape*> obj = std::vector<ObjectShape*>() );
52 IRay(const IRay& r)
53 {
54 this->E1 = r.E1;
55 this->E2 = r.E2;
56
57 this->numObj = r.numObj;
58 this->Obj = r.Obj;
59 this->objIndex = r.objIndex;
60 this->inObject = r.inObject;
61 this->iR = r.iR;
62 this->isValid = r.isValid;
63 this->k = r.k;
64 this->k0 = r.k0;
65 this->KORR = r.KORR;
66 this->n = r.n;
67 this->OK = r.OK;
68 this->P = r.P;
69 this->r0 = r.r0;
70 this->status = r.status;
72 }
73
74
75 bool next();
76
86 IRay reflect(maths::Vector<double> n, std::complex<double> n1, std::complex<double> n2);
95 void refract(maths::Vector<double> N, std::complex<double> n1, std::complex<double> n2);
96 void setRefract(std::complex<double> n) { this->n = n; }
97 std::complex<double> getRefract() { return n; }
98 void setk(const maths::Vector<double>& K) { k = K; }
99 void setP(const maths::Vector<double>& p) { P = p; }
100 void setiR(int i) { iR = i; }
101 // void setGetunnelt (bool v) { getunnelt=v; }
104 int objectIndex() { return objIndex; }
112 void reflectRay(RayBase*& tray, maths::Vector<double> n, std::complex<double> n1, std::complex<double> n2);
113 ObjectShape* getObject(int i) { return Obj[i]; }
115 bool isInObject() { return inObject; }
121 int currentObjectIndex() { return objIndex; }
122 friend std::ostream& operator << (std::ostream& os, IRay S);
123 int reflections() { return iR; }
124
125 public:
128
129 maths::Matrix<std::complex<double> > Fresnel_reflect(double alpha, std::complex<double> n1, std::complex<double> n2);
130 maths::Matrix<std::complex<double> > Fresnel_trans(double alpha, std::complex<double> beta, std::complex<double> n1, std::complex<double> n2);
131 void initElectricField(const Plane& Eb, const maths::Vector<std::complex<double> >& Pol, const int numOfRays = 1);
132 void initElectricField(const maths::Vector<std::complex<double> >& PolS, const maths::Vector<std::complex<double> >& PolP, const int AnzRays);
133 void initElectricField(const Plane& Eb, const maths::Vector<std::complex<double> >& Pol1, const maths::Vector<std::complex<double> >& Pol2, const int AnzRays);
143 void initElectricFieldGauss(double sigma2, maths::Vector<double> focuspos, maths::Vector<std::complex<double> > Pol);
145 const maths::Vector<std::complex<double> >& PolS,
146 const maths::Vector<std::complex<double> >& PolP,
147 Gauss g);
148
149 void initElectricFieldGauss(maths::Vector<std::complex<double> >& Pol, Gauss g);
151
157
158
159
163
164 protected:
166 double KORR;
168 };
169 }
170}
This class represents a threedimensional (numeric) Matrix as a template.
Definition matrix.h:23
Template class for threedimensional vectors.
Definition vector.h:57
maths::Vector< std::complex< double > > Pol2()
direction of the second polarisation
Definition iray.h:127
maths::Vector< double > OK
Definition iray.h:165
void reflectRay(RayBase *&tray, maths::Vector< double > n, std::complex< double > n1, std::complex< double > n2)
Reflects ray on the surface /param tray Transmitted (=refracted) ray /param n Surface normal /param n...
maths::Vector< double > k
current direction
Definition iray.h:161
void refract(maths::Vector< double > N, std::complex< double > n1, std::complex< double > n2)
This function refracts the ray on the surface.
void setRefract(std::complex< double > n)
Sets the current refractive index.
Definition iray.h:96
maths::Vector< double > P
current position
Definition iray.h:160
int currentObjectIndex()
returns the index of the hidden object or -1
Definition iray.h:121
maths::Vector< std::complex< double > > getE()
gives back electric field strength
Definition iray.h:77
std::complex< double > getRefract()
Returns the current refractive index.
Definition iray.h:97
IRay reflect(maths::Vector< double > n, std::complex< double > n1, std::complex< double > n2)
This function reflects ray on the surface. Here, the ray is reflected and the transmitted ray is crea...
void setP(const maths::Vector< double > &p)
Current position of the ray.
Definition iray.h:99
maths::Vector< double > getP()
Returns the current position of the ray.
Definition iray.h:103
bool checkObjectIntersection(int &Index, maths::Vector< double > &Pmin)
void initElectricFieldGauss(maths::Vector< std::complex< double > > &Pol, Gauss g)
Initialises the ray for gaussian beam with help of the plane Eb and the polarisation vector Pol (seco...
maths::Matrix< std::complex< double > > Fresnel_reflect(double alpha, std::complex< double > n1, std::complex< double > n2)
returns Fresnel matrix for the reflection calculation (alpha: angle of incidence, n1,...
maths::Vector< double > intersectRect(const maths::Vector< double > P, const maths::Vector< double > e1, const maths::Vector< double > e2)
double cross(const maths::Vector< double > P10, const maths::Vector< double > P11, const maths::Vector< double > P20, const maths::Vector< double > P21)
void setk(const maths::Vector< double > &K)
Sets the direction of the ray.
Definition iray.h:98
IRay(const maths::Vector< double > &p, const maths::Vector< std::complex< double > > &Pol, const maths::Vector< double > &K, std::complex< double > n0, double r0, double k0, const int numObj=0, std::vector< ObjectShape * > obj=std::vector< ObjectShape * >())
Contructor.
void initElectricField(const Plane &Eb, const maths::Vector< std::complex< double > > &Pol1, const maths::Vector< std::complex< double > > &Pol2, const int AnzRays)
void initElectricField(const Plane &Eb, const maths::Vector< std::complex< double > > &Pol, const int numOfRays=1)
initialises the electric field with help of the Plane Eb and the polarisation Pol,...
void initElectricField(const maths::Vector< std::complex< double > > &PolS, const maths::Vector< std::complex< double > > &PolP, const int AnzRays)
initialises the electric field vectors with help of polarisation vectors PolS and PolP,...
maths::Matrix< std::complex< double > > Fresnel_trans(double alpha, std::complex< double > beta, std::complex< double > n1, std::complex< double > n2)
returns Fresnel matrix for the transmission calculation (alpha: angle of incidence,...
IRay(const IRay &r)
Definition iray.h:52
ObjectShape * getObject(int i)
Returns the i-th object (for internal use only)
Definition iray.h:113
bool next()
make the next step (has to include phase progress)
maths::Vector< std::complex< double > > Pol1()
direction of the first polarisation
Definition iray.h:126
int objectIndex()
Returns the index of the last hidden object (or -1 if no object was hidden)
Definition iray.h:104
maths::Vector< std::complex< double > > E2
electric fields
Definition iray.h:162
maths::Vector< std::complex< double > > E1
Definition iray.h:162
void setiR(int i)
Sets the current reflexion counter (for internal use only)
Definition iray.h:100
bool isInObject()
Returns true if ray is inside an object.
Definition iray.h:115
maths::Vector< double > crossPlane(const maths::Vector< double > Pe, const maths::Vector< double > n)
calculates the intersection point between the ray and a plane, which is defined by the vector P and t...
int reflections()
Returns the number of reflections the beam has already passed through.
Definition iray.h:123
maths::Vector< double > getk()
Returns the direction of the ray.
Definition iray.h:102
void initElectricFieldGauss(const Plane &Eb, const maths::Vector< std::complex< double > > &PolS, const maths::Vector< std::complex< double > > &PolP, Gauss g)
Initialises the ray for gaussian beam with help of the plane Eb and the polarisation vectors PolS and...
friend std::ostream & operator<<(std::ostream &os, IRay S)
void initElectricFieldGauss(double sigma2, maths::Vector< double > focuspos, maths::Vector< std::complex< double > > Pol)
Abstract base class for all volume objects This abstract class provides a template for all volume obj...
Definition objectshape.h:60
Abstract base class for all rays used for the raytracing process. This abstract base class for all ra...
Definition raybase.h:16
int objIndex
index of the current object
Definition raybase.h:29
std::complex< double > n0
current refractive index and refractive index of the host material
Definition raybase.h:30
bool inObject
is in an object
Definition raybase.h:26
std::complex< double > n
Definition raybase.h:30
int numObj
number of objects
Definition raybase.h:28
std::vector< ObjectShape * > Obj
list of all objects
Definition raybase.h:27
bool suppress_phase_progress
suppress phase change in next(), needed for short pulse consideration
Definition raybase.h:34
RayBase * tray
transmitted ray (used by the raytracer, for internal use only)
Definition raybase.h:25
double k0
wave number
Definition raybase.h:31
int iR
number of reflections already done
Definition raybase.h:33
This file contains the definition of a template for 3x3 matrices, which can be used together with the...
Raytracer used for ultrashort pulse calculation with raytracing only.
Definition asphericLens.h:6
This class is used for the iray class. This class is intended for internal use only....
Definition fresnel.h:7
This file contains the Vector template class and some useful functions around this class.