GOAT (Geometrical optics application tool) 0.1
Loading...
Searching...
No Matches
GOAT::raytracing::IRay Class Reference

This class represents a single ray. More...

#include <iray.h>

Inheritance diagram for GOAT::raytracing::IRay:
GOAT::raytracing::RayBase GOAT::raytracing::Ray_pow

Public Member Functions

bool checkObjectIntersection (int &Index, maths::Vector< double > &Pmin)
double cross (const maths::Vector< double > P10, const maths::Vector< double > P11, const maths::Vector< double > P20, const maths::Vector< double > P21)
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 the normal n
int currentObjectIndex ()
 returns the index of the hidden object or -1
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,n2 are the refractive indices)
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, n1,n2 are the refractive indices)
maths::Vector< std::complex< double > > getE ()
 gives back electric field strength
maths::Vector< double > getk ()
 Returns the direction of the ray.
ObjectShapegetObject (int i)
 Returns the i-th object (for internal use only)
maths::Vector< double > getP ()
 Returns the current position of the ray.
std::complex< double > getRefract ()
 Returns the current refractive index.
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, numOfRays can be omitted
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, numOfRays can be omitted. (Here, only one polarisation is given, the other is skipped)
void initElectricField (const Plane &Eb, const maths::Vector< std::complex< double > > &Pol1, const maths::Vector< std::complex< double > > &Pol2, const int AnzRays)
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 PolP. The parameters for the gaussian beam are stored in g.
void initElectricFieldGauss (double sigma2, maths::Vector< double > focuspos, maths::Vector< std::complex< double > > Pol)
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 (second polarisation is not used, E2 is set to E1). The parameters for the gaussian beam are stored in g.
maths::Vector< double > intersectRect (const maths::Vector< double > P, const maths::Vector< double > e1, const maths::Vector< double > e2)
 IRay ()
 IRay (const IRay &r)
 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.
bool isInObject ()
 Returns true if ray is inside an object.
bool next ()
 make the next step (has to include phase progress)
int objectIndex ()
 Returns the index of the last hidden object (or -1 if no object was hidden)
maths::Vector< std::complex< double > > Pol1 ()
 direction of the first polarisation
maths::Vector< std::complex< double > > Pol2 ()
 direction of the second polarisation
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 created.
int reflections ()
 Returns the number of reflections the beam has already passed through.
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 n1 Refractive index (incident side) /param n2 Refractive index (transmitted side)
void refract (maths::Vector< double > N, std::complex< double > n1, std::complex< double > n2)
 This function refracts the ray on the surface.
void setiR (int i)
 Sets the current reflexion counter (for internal use only)
void setk (const maths::Vector< double > &K)
 Sets the direction of the ray.
void setP (const maths::Vector< double > &p)
 Current position of the ray.
void setRefract (std::complex< double > n)
 Sets the current refractive index.
 ~IRay ()

Public Attributes

maths::Vector< std::complex< double > > E1
maths::Vector< std::complex< double > > E2
 electric fields
maths::Vector< double > k
 current direction
maths::Vector< double > P
 current position
Public Attributes inherited from GOAT::raytracing::RayBase
bool inObject =false
 is in an object
int iR =0
 number of reflections already done
double k0 =2.0*M_PI
 wave number
std::complex< double > n
std::complex< double > n0
 current refractive index and refractive index of the host material
int numObj =0
 number of objects
std::vector< ObjectShape * > Obj
 list of all objects
int objIndex =0
 index of the current object
double r0 =1.0
double rc =1.0
 radius of the calculation sphere
int status = RAYBASE_STATUS_NONE
bool suppress_phase_progress =false
 suppress phase change in next(), needed for short pulse consideration
RayBasetray =0
 transmitted ray (used by the raytracer, for internal use only)

Protected Attributes

bool isValid
double KORR
maths::Vector< double > OK

Friends

std::ostream & operator<< (std::ostream &os, IRay S)

Detailed Description

This class represents a single ray.

This ray is intended to calculate with a single ray with two different polarisations. This class should not be used directly. It is intended for use together with classes derived by LightSrc (like LightSrcPlane or LightSrcGauss)

Definition at line 33 of file iray.h.

Constructor & Destructor Documentation

◆ IRay() [1/3]

GOAT::raytracing::IRay::IRay ( )

◆ IRay() [2/3]

GOAT::raytracing::IRay::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.

Parameters
pPosition of the ray
PolPolarisation (in the moment not used)
Kdirection of the ray
n0refractive index
r0radius of the calculation sphere
k0wavenumber (=2*pi/wavelength in vacuum)
numObjnumber of objects
objlist of the objects

◆ IRay() [3/3]

GOAT::raytracing::IRay::IRay ( const IRay & r)
inline

Definition at line 52 of file iray.h.

◆ ~IRay()

GOAT::raytracing::IRay::~IRay ( )

Member Function Documentation

◆ checkObjectIntersection()

bool GOAT::raytracing::IRay::checkObjectIntersection ( int & Index,
maths::Vector< double > & Pmin )

Checks wether there is an intersection between the ray and an object or not. In case of an intersection the function returns true and Index is set to the index of the object within the object list and Pmin gives the (nearest) intersection point

◆ cross()

double GOAT::raytracing::IRay::cross ( const maths::Vector< double > P10,
const maths::Vector< double > P11,
const maths::Vector< double > P20,
const maths::Vector< double > P21 )

◆ crossPlane()

maths::Vector< double > GOAT::raytracing::IRay::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 the normal n

◆ currentObjectIndex()

int GOAT::raytracing::IRay::currentObjectIndex ( )
inline

returns the index of the hidden object or -1

Definition at line 121 of file iray.h.

◆ Fresnel_reflect()

maths::Matrix< std::complex< double > > GOAT::raytracing::IRay::Fresnel_reflect ( double alpha,
std::complex< double > n1,
std::complex< double > n2 )

returns Fresnel matrix for the reflection calculation (alpha: angle of incidence, n1,n2 are the refractive indices)

◆ Fresnel_trans()

maths::Matrix< std::complex< double > > GOAT::raytracing::IRay::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, n1,n2 are the refractive indices)

◆ getE()

maths::Vector< std::complex< double > > GOAT::raytracing::IRay::getE ( )
inlinevirtual

gives back electric field strength

Implements GOAT::raytracing::RayBase.

Definition at line 77 of file iray.h.

◆ getk()

maths::Vector< double > GOAT::raytracing::IRay::getk ( )
inlinevirtual

Returns the direction of the ray.

Implements GOAT::raytracing::RayBase.

Definition at line 102 of file iray.h.

◆ getObject()

ObjectShape * GOAT::raytracing::IRay::getObject ( int i)
inline

Returns the i-th object (for internal use only)

Definition at line 113 of file iray.h.

◆ getP()

maths::Vector< double > GOAT::raytracing::IRay::getP ( )
inlinevirtual

Returns the current position of the ray.

Implements GOAT::raytracing::RayBase.

Definition at line 103 of file iray.h.

◆ getRefract()

std::complex< double > GOAT::raytracing::IRay::getRefract ( )
inline

Returns the current refractive index.

Definition at line 97 of file iray.h.

◆ initElectricField() [1/3]

void GOAT::raytracing::IRay::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, numOfRays can be omitted

◆ initElectricField() [2/3]

void GOAT::raytracing::IRay::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, numOfRays can be omitted. (Here, only one polarisation is given, the other is skipped)

◆ initElectricField() [3/3]

void GOAT::raytracing::IRay::initElectricField ( const Plane & Eb,
const maths::Vector< std::complex< double > > & Pol1,
const maths::Vector< std::complex< double > > & Pol2,
const int AnzRays )

◆ initElectricFieldGauss() [1/3]

void GOAT::raytracing::IRay::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 PolP. The parameters for the gaussian beam are stored in g.

◆ initElectricFieldGauss() [2/3]

void GOAT::raytracing::IRay::initElectricFieldGauss ( double sigma2,
maths::Vector< double > focuspos,
maths::Vector< std::complex< double > > Pol )

Initialises the ray for a gaussian beam according to

\( \vec E=\vec{Pol} \cdot e^{-ik_0h} \cdot e^{-(r^2-h^2)/\sigma_2} \) where \( r=(\vec{F}-\vec{P})\cdot\vec{k},~h=r-|\vec{F}-\vec{P}| \) ( \(\vec{F}\): focal point)

E1 and E2 are set to the same value !

◆ initElectricFieldGauss() [3/3]

void GOAT::raytracing::IRay::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 (second polarisation is not used, E2 is set to E1). The parameters for the gaussian beam are stored in g.

◆ intersectRect()

maths::Vector< double > GOAT::raytracing::IRay::intersectRect ( const maths::Vector< double > P,
const maths::Vector< double > e1,
const maths::Vector< double > e2 )

Calculates the intersection point between the ray and a rectangle defined by the edge point P and the vectors e1 and e2. If there is no intersection point, a NaN valued vector is returned.

◆ isInObject()

bool GOAT::raytracing::IRay::isInObject ( )
inlinevirtual

Returns true if ray is inside an object.

Implements GOAT::raytracing::RayBase.

Definition at line 115 of file iray.h.

◆ next()

bool GOAT::raytracing::IRay::next ( )
virtual

make the next step (has to include phase progress)

Implements GOAT::raytracing::RayBase.

◆ objectIndex()

int GOAT::raytracing::IRay::objectIndex ( )
inlinevirtual

Returns the index of the last hidden object (or -1 if no object was hidden)

Implements GOAT::raytracing::RayBase.

Definition at line 104 of file iray.h.

◆ Pol1()

maths::Vector< std::complex< double > > GOAT::raytracing::IRay::Pol1 ( )
inline

direction of the first polarisation

Definition at line 126 of file iray.h.

◆ Pol2()

maths::Vector< std::complex< double > > GOAT::raytracing::IRay::Pol2 ( )
inline

direction of the second polarisation

Definition at line 127 of file iray.h.

◆ reflect()

IRay GOAT::raytracing::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 created.

Parameters
nSurface normal
n1Refractive index (incident side)
n2Refractive index (transmitted side)
Returns
Transmitted ray

◆ reflections()

int GOAT::raytracing::IRay::reflections ( )
inline

Returns the number of reflections the beam has already passed through.

Definition at line 123 of file iray.h.

◆ reflectRay()

void GOAT::raytracing::IRay::reflectRay ( RayBase *& tray,
maths::Vector< double > n,
std::complex< double > n1,
std::complex< double > n2 )
virtual

Reflects ray on the surface /param tray Transmitted (=refracted) ray /param n Surface normal /param n1 Refractive index (incident side) /param n2 Refractive index (transmitted side)

Implements GOAT::raytracing::RayBase.

Reimplemented in GOAT::raytracing::Ray_pow.

◆ refract()

void GOAT::raytracing::IRay::refract ( maths::Vector< double > N,
std::complex< double > n1,
std::complex< double > n2 )

This function refracts the ray on the surface.

Parameters
NSurface normal
n1Refractive index (incident side)
n2Refractive index (transmitted side)

◆ setiR()

void GOAT::raytracing::IRay::setiR ( int i)
inline

Sets the current reflexion counter (for internal use only)

Definition at line 100 of file iray.h.

◆ setk()

void GOAT::raytracing::IRay::setk ( const maths::Vector< double > & K)
inline

Sets the direction of the ray.

Definition at line 98 of file iray.h.

◆ setP()

void GOAT::raytracing::IRay::setP ( const maths::Vector< double > & p)
inline

Current position of the ray.

Definition at line 99 of file iray.h.

◆ setRefract()

void GOAT::raytracing::IRay::setRefract ( std::complex< double > n)
inline

Sets the current refractive index.

Definition at line 96 of file iray.h.

◆ operator<<

std::ostream & operator<< ( std::ostream & os,
IRay S )
friend

Member Data Documentation

◆ E1

maths::Vector<std::complex<double> > GOAT::raytracing::IRay::E1

Definition at line 162 of file iray.h.

◆ E2

maths::Vector<std::complex<double> > GOAT::raytracing::IRay::E2

electric fields

Definition at line 162 of file iray.h.

◆ isValid

bool GOAT::raytracing::IRay::isValid
protected

Definition at line 167 of file iray.h.

◆ k

maths::Vector<double> GOAT::raytracing::IRay::k

current direction

Definition at line 161 of file iray.h.

◆ KORR

double GOAT::raytracing::IRay::KORR
protected

Definition at line 166 of file iray.h.

◆ OK

maths::Vector<double> GOAT::raytracing::IRay::OK
protected

Definition at line 165 of file iray.h.

◆ P

maths::Vector<double> GOAT::raytracing::IRay::P

current position

Definition at line 160 of file iray.h.


The documentation for this class was generated from the following file: