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

This abstract class is the basic class for all light sources used in this raytracing library. It provides all necessary interfaces. More...

#include <lightsrc.h>

Inheritance diagram for GOAT::raytracing::LightSrc:
GOAT::raytracing::LightSrcGauss GOAT::raytracing::LightSrcLine GOAT::raytracing::LightSrcLine_mc GOAT::raytracing::LightSrcPlane GOAT::raytracing::LightSrcPoint_mc GOAT::raytracing::LightSrcRing GOAT::raytracing::LightSrcGauss_mc GOAT::raytracing::LightSrcPlane_mc GOAT::raytracing::LightSrcRingGauss_mc GOAT::raytracing::LightSrcRing_mc

Public Member Functions

void addObject (ObjectShape *obj)
 add single object to the object list
void adjustDirection ()
void binRead (std::ifstream &is)
 writes content of LightSrc in a binary file, represented by is
virtual void binReadItem (std::ifstream &os)=0
 reads content of LightSrc from a binary file, represented by os (has to be specified by the derived classes)
void binWrite (std::ofstream &os)
 reads content of LightSrc from a binary file, represented by os
virtual void binWriteItem (std::ofstream &os)=0
 writes content of LightSrc in a binary file, represented by is (has to be specified by the derived classes)focuspos
void clearObjects ()
 clear object list
double getDensity ()
 returns the ray density, i.e. the number of rays per unit length (=D/N)
maths::Vector< std::complex< double > > getInitPol ()
double getIsum1 ()
double getIsum2 ()
maths::Vector< double > getk ()
 returns the main direction of the light source
int getNumObjs ()
 returns the number of Objects (only needed, when used seperately outside scene)
int getNumRays ()
 returns the number of rays (per direction in space)
int getNumRaysRT ()
ObjectShapegetObject (int i)
 returns i-th item in the object list
maths::Vector< double > getPos ()
 returns the position of the light source. This is the center of the square area of the light source
double getWavelength ()
double getWavenumber ()
 LightSrc ()
 LightSrc (const LightSrc &)
 Copy constructor.
void ObjectList (int Anz, std::vector< ObjectShape * > Obj)
int rayType ()
 returns the current ray type
void removeObject (ObjectShape *obj)
 remove object from the object list
void reset ()
 Reset everything (counting starts from the beginning)
void setD (double D)
 sets the width of the light source (this resets also the ray counter)
void setD (double D1, double D2)
void setk (const maths::Vector< double > &k)
 sets the main direction of the light source
void setN0 (std::complex< double > n0)
 sets the complex valued refractive index of the intermediate medium
void setNumRays (int N)
void setNumRaysRT (int numRaysRT)
void setObject (ObjectShape *O, int i=-1)
 exchanges i-th object in the object list
void setPol (maths::Vector< std::complex< double > > pol)
 sets the polarisation
void setPos (maths::Vector< double > P)
 sets the position of the light source. This is the center of the square area of the light source
void setR0 (double r0)
 sets the radius of the calculation sphere
void setWavelength (double wvl)
void setWavenumber (double k0)
 ~LightSrc (void)
virtual int next (RayBase *ray)=0
virtual int next (Ray_pow &ray)=0
virtual int next (IRay &ray)=0
virtual int next (tubedRay &ray)=0
virtual double area ()

Public Attributes

double D
 width of the square light source area
double D1
double D2
 width in the e1- and the e2-direction (used only for _mc versions of LightSrc)
double density
 ray density, i.e. distance between two neighboring rays
maths::Vector< double > e1
maths::Vector< double > e2
 unit vectors that span the light source area
int i1
 first index of the ray inside the starting area (for internal use, -1 if the calculation has not yet been started)
int i2
 second index of the ray inside the starting area (for internal use, -1 if the calculation has not yet been started)
maths::Vector< std::complex< double > > initPol
 Polarisation, if the k-Vector points in z-direction.
maths::Vector< double > k
 main direction of the light source
int N =10000
 number of rays (per direction)
std::complex< double > n0
 refractive index of the intermediate medium
int numObjs
 number of objects
std::vector< ObjectShape * > Obj
 list of all objects
double P0 =1.0
 power
double Pall
 overall Power
maths::Vector< std::complex< double > > Pol
 polarisation (default: (0.0, 1.0, 0.0)
maths::Vector< std::complex< double > > Pol2
 second polarisation (used by IRay)
int polType
 Polarisationsrichtung (s.o.)
maths::Vector< double > Pos
 position of the light source (center of the square area of the light source)
double r0 =1.0
 radius of the calculation sphere
int rayCounter =0
int raytype
 Strahltyp : ray oder ISTRAHL (=RAY oder IRAY)
bool suppress_phase_progress = false
 if set true, the phase won't be changed when calling a next method (needed for USP-calculations)
int type
 type of the light source

Protected Attributes

double Isum1
double Isum2
double k0
 wavenumber (i.e. \( \frac{2\pi}{\lambda}\)
int numRaysRT =20
 used in GOATvis to determine number of rays for ray representation
maths::Vector< double > rotVec =maths::Vector<double>(1,0,0)
 Vector which holds the spherical coordinates \(r\), \(\vartheta\) and \(\varphi\) of the direction vector k.
double wvl =1
 wavelength

Friends

class LightSrcGauss
class LightSrcPlane
std::ostream & operator<< (std::ostream &os, LightSrc *ls)

Detailed Description

This abstract class is the basic class for all light sources used in this raytracing library. It provides all necessary interfaces.

LightSrc: the virtual base class for describing light sources. Each light source is defined by a quadratic area as starting area for the corresponding rays and a reference point Pos in the middle of this area. The direction has to be defined separately in the derived class. It provides a standard programming interface for light sources. The virtual function next(...) gives the next ray with the light source dependent parameters (position, direction, strength of the electric field etc.). The return parameter has three possible values: LIGHTSRC_NOT_LAST_RAY: the created ray is not the last ray, LIGHTSRC_IS_LAST_RAY: the last ray was created (i.e. the raytracing is at its end) and LIGHTSRC_ERROR: an error occurs. The routine reset() resets the ray counter to its initial value, so the next call of the routine next() gives the first ray. Since the rays need information about the objects to be able to calculate the crossing points with the object surface, LightSrc provides routines to pass these informations to the rays. These routines are only needed for calculations without the raytracing process, especially without the Scene class.

Polarisation:

When calling the setPol function, the polarisation is set as if the direction would be in z-direction and afterwards the polarisation will be rotated according to the above picture. If the direction vector is changed using setk, the direction of the polarization is changed accordingly.

Definition at line 66 of file lightsrc.h.

Constructor & Destructor Documentation

◆ ~LightSrc()

GOAT::raytracing::LightSrc::~LightSrc ( void )

◆ LightSrc() [1/2]

GOAT::raytracing::LightSrc::LightSrc ( )

◆ LightSrc() [2/2]

GOAT::raytracing::LightSrc::LightSrc ( const LightSrc & )

Copy constructor.

Member Function Documentation

◆ addObject()

void GOAT::raytracing::LightSrc::addObject ( ObjectShape * obj)

add single object to the object list

◆ adjustDirection()

void GOAT::raytracing::LightSrc::adjustDirection ( )

◆ area()

virtual double GOAT::raytracing::LightSrc::area ( )
inlinevirtual

◆ binRead()

void GOAT::raytracing::LightSrc::binRead ( std::ifstream & is)

writes content of LightSrc in a binary file, represented by is

◆ binReadItem()

virtual void GOAT::raytracing::LightSrc::binReadItem ( std::ifstream & os)
pure virtual

reads content of LightSrc from a binary file, represented by os (has to be specified by the derived classes)

Implemented in GOAT::raytracing::LightSrcGauss, GOAT::raytracing::LightSrcLine, GOAT::raytracing::LightSrcLine_mc, GOAT::raytracing::LightSrcPlane, GOAT::raytracing::LightSrcPoint_mc, and GOAT::raytracing::LightSrcRing.

◆ binWrite()

void GOAT::raytracing::LightSrc::binWrite ( std::ofstream & os)

reads content of LightSrc from a binary file, represented by os

◆ binWriteItem()

virtual void GOAT::raytracing::LightSrc::binWriteItem ( std::ofstream & os)
pure virtual

writes content of LightSrc in a binary file, represented by is (has to be specified by the derived classes)focuspos

Implemented in GOAT::raytracing::LightSrcGauss, GOAT::raytracing::LightSrcLine, GOAT::raytracing::LightSrcLine_mc, GOAT::raytracing::LightSrcPlane, GOAT::raytracing::LightSrcPoint_mc, and GOAT::raytracing::LightSrcRing.

◆ clearObjects()

void GOAT::raytracing::LightSrc::clearObjects ( )

clear object list

◆ getDensity()

double GOAT::raytracing::LightSrc::getDensity ( )
inline

returns the ray density, i.e. the number of rays per unit length (=D/N)

Definition at line 101 of file lightsrc.h.

◆ getInitPol()

maths::Vector< std::complex< double > > GOAT::raytracing::LightSrc::getInitPol ( )
inline

Definition at line 102 of file lightsrc.h.

◆ getIsum1()

double GOAT::raytracing::LightSrc::getIsum1 ( )
inline

Definition at line 178 of file lightsrc.h.

◆ getIsum2()

double GOAT::raytracing::LightSrc::getIsum2 ( )
inline

Definition at line 179 of file lightsrc.h.

◆ getk()

maths::Vector< double > GOAT::raytracing::LightSrc::getk ( )
inline

returns the main direction of the light source

Definition at line 131 of file lightsrc.h.

◆ getNumObjs()

int GOAT::raytracing::LightSrc::getNumObjs ( )
inline

returns the number of Objects (only needed, when used seperately outside scene)

Definition at line 96 of file lightsrc.h.

◆ getNumRays()

int GOAT::raytracing::LightSrc::getNumRays ( )
inline

returns the number of rays (per direction in space)

Definition at line 132 of file lightsrc.h.

◆ getNumRaysRT()

int GOAT::raytracing::LightSrc::getNumRaysRT ( )
inline

Definition at line 126 of file lightsrc.h.

◆ getObject()

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

returns i-th item in the object list

Definition at line 97 of file lightsrc.h.

◆ getPos()

maths::Vector< double > GOAT::raytracing::LightSrc::getPos ( )
inline

returns the position of the light source. This is the center of the square area of the light source

Definition at line 146 of file lightsrc.h.

◆ getWavelength()

double GOAT::raytracing::LightSrc::getWavelength ( )
inline

Definition at line 140 of file lightsrc.h.

◆ getWavenumber()

double GOAT::raytracing::LightSrc::getWavenumber ( )
inline

Definition at line 142 of file lightsrc.h.

◆ next() [1/4]

◆ next() [2/4]

◆ next() [3/4]

virtual int GOAT::raytracing::LightSrc::next ( RayBase * ray)
pure virtual

These functions return the next ray of the light source for further calculations

Parameters
raynext ray
Return values
LIGHTSRC_NOT_LAST_RAY,ifray is not the last ray, LIGHTSRC_IS_LAST_RAY, if the ray is the last ray or LIGHTSRC_ERROR if an error occured

Implemented in GOAT::raytracing::LightSrcGauss, GOAT::raytracing::LightSrcLine, GOAT::raytracing::LightSrcLine_mc, GOAT::raytracing::LightSrcPlane, GOAT::raytracing::LightSrcPoint_mc, and GOAT::raytracing::LightSrcRing.

◆ next() [4/4]

◆ ObjectList()

void GOAT::raytracing::LightSrc::ObjectList ( int Anz,
std::vector< ObjectShape * > Obj )

import object list

◆ rayType()

int GOAT::raytracing::LightSrc::rayType ( )
inline

returns the current ray type

Definition at line 99 of file lightsrc.h.

◆ removeObject()

void GOAT::raytracing::LightSrc::removeObject ( ObjectShape * obj)

remove object from the object list

◆ reset()

void GOAT::raytracing::LightSrc::reset ( )

Reset everything (counting starts from the beginning)

◆ setD() [1/2]

void GOAT::raytracing::LightSrc::setD ( double D)
inline

sets the width of the light source (this resets also the ray counter)

Parameters
Dsets the width of the light source

Definition at line 103 of file lightsrc.h.

◆ setD() [2/2]

void GOAT::raytracing::LightSrc::setD ( double D1,
double D2 )
inline
Parameters
D2sets the width of the light source

Definition at line 112 of file lightsrc.h.

◆ setk()

void GOAT::raytracing::LightSrc::setk ( const maths::Vector< double > & k)

sets the main direction of the light source

◆ setN0()

void GOAT::raytracing::LightSrc::setN0 ( std::complex< double > n0)
inline

sets the complex valued refractive index of the intermediate medium

Definition at line 147 of file lightsrc.h.

◆ setNumRays()

void GOAT::raytracing::LightSrc::setNumRays ( int N)
inline
Parameters
Nsets the number of rays (per direction in space)

Definition at line 133 of file lightsrc.h.

◆ setNumRaysRT()

void GOAT::raytracing::LightSrc::setNumRaysRT ( int numRaysRT)
inline

Definition at line 121 of file lightsrc.h.

◆ setObject()

void GOAT::raytracing::LightSrc::setObject ( ObjectShape * O,
int i = -1 )

exchanges i-th object in the object list

◆ setPol()

void GOAT::raytracing::LightSrc::setPol ( maths::Vector< std::complex< double > > pol)

sets the polarisation

◆ setPos()

void GOAT::raytracing::LightSrc::setPos ( maths::Vector< double > P)

sets the position of the light source. This is the center of the square area of the light source

◆ setR0()

void GOAT::raytracing::LightSrc::setR0 ( double r0)

sets the radius of the calculation sphere

◆ setWavelength()

void GOAT::raytracing::LightSrc::setWavelength ( double wvl)
inline

Definition at line 139 of file lightsrc.h.

◆ setWavenumber()

void GOAT::raytracing::LightSrc::setWavenumber ( double k0)
inline

Definition at line 141 of file lightsrc.h.

◆ LightSrcGauss

friend class LightSrcGauss ( void )
friend

Definition at line 173 of file lightsrc.h.

◆ LightSrcPlane

friend class LightSrcPlane ( void )
friend

Definition at line 172 of file lightsrc.h.

◆ operator<<

std::ostream & operator<< ( std::ostream & os,
LightSrc * ls )
friend

Member Data Documentation

◆ D

double GOAT::raytracing::LightSrc::D

width of the square light source area

Definition at line 165 of file lightsrc.h.

◆ D1

double GOAT::raytracing::LightSrc::D1

Definition at line 166 of file lightsrc.h.

◆ D2

double GOAT::raytracing::LightSrc::D2

width in the e1- and the e2-direction (used only for _mc versions of LightSrc)

Definition at line 166 of file lightsrc.h.

◆ density

double GOAT::raytracing::LightSrc::density

ray density, i.e. distance between two neighboring rays

Definition at line 153 of file lightsrc.h.

◆ e1

maths::Vector<double> GOAT::raytracing::LightSrc::e1

Definition at line 167 of file lightsrc.h.

◆ e2

maths::Vector<double> GOAT::raytracing::LightSrc::e2

unit vectors that span the light source area

Definition at line 167 of file lightsrc.h.

◆ i1

int GOAT::raytracing::LightSrc::i1

first index of the ray inside the starting area (for internal use, -1 if the calculation has not yet been started)

Definition at line 156 of file lightsrc.h.

◆ i2

int GOAT::raytracing::LightSrc::i2

second index of the ray inside the starting area (for internal use, -1 if the calculation has not yet been started)

Definition at line 157 of file lightsrc.h.

◆ initPol

maths::Vector<std::complex<double> > GOAT::raytracing::LightSrc::initPol

Polarisation, if the k-Vector points in z-direction.

Definition at line 170 of file lightsrc.h.

◆ Isum1

double GOAT::raytracing::LightSrc::Isum1
protected

Definition at line 185 of file lightsrc.h.

◆ Isum2

double GOAT::raytracing::LightSrc::Isum2
protected

Definition at line 185 of file lightsrc.h.

◆ k

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

main direction of the light source

Definition at line 154 of file lightsrc.h.

◆ k0

double GOAT::raytracing::LightSrc::k0
protected

wavenumber (i.e. \( \frac{2\pi}{\lambda}\)

Definition at line 183 of file lightsrc.h.

◆ N

int GOAT::raytracing::LightSrc::N =10000

number of rays (per direction)

Definition at line 155 of file lightsrc.h.

◆ n0

std::complex<double> GOAT::raytracing::LightSrc::n0

refractive index of the intermediate medium

Definition at line 163 of file lightsrc.h.

◆ numObjs

int GOAT::raytracing::LightSrc::numObjs

number of objects

Definition at line 162 of file lightsrc.h.

◆ numRaysRT

int GOAT::raytracing::LightSrc::numRaysRT =20
protected

used in GOATvis to determine number of rays for ray representation

Definition at line 186 of file lightsrc.h.

◆ Obj

std::vector<ObjectShape*> GOAT::raytracing::LightSrc::Obj

list of all objects

Definition at line 148 of file lightsrc.h.

◆ P0

double GOAT::raytracing::LightSrc::P0 =1.0

power

Definition at line 152 of file lightsrc.h.

◆ Pall

double GOAT::raytracing::LightSrc::Pall

overall Power

Definition at line 171 of file lightsrc.h.

◆ Pol

maths::Vector<std::complex<double> > GOAT::raytracing::LightSrc::Pol

polarisation (default: (0.0, 1.0, 0.0)

Definition at line 158 of file lightsrc.h.

◆ Pol2

maths::Vector<std::complex<double> > GOAT::raytracing::LightSrc::Pol2

second polarisation (used by IRay)

Definition at line 159 of file lightsrc.h.

◆ polType

int GOAT::raytracing::LightSrc::polType

Polarisationsrichtung (s.o.)

Definition at line 169 of file lightsrc.h.

◆ Pos

maths::Vector<double> GOAT::raytracing::LightSrc::Pos

position of the light source (center of the square area of the light source)

Definition at line 150 of file lightsrc.h.

◆ r0

double GOAT::raytracing::LightSrc::r0 =1.0

radius of the calculation sphere

Definition at line 160 of file lightsrc.h.

◆ rayCounter

int GOAT::raytracing::LightSrc::rayCounter =0

Definition at line 176 of file lightsrc.h.

◆ raytype

int GOAT::raytracing::LightSrc::raytype

Strahltyp : ray oder ISTRAHL (=RAY oder IRAY)

Definition at line 168 of file lightsrc.h.

◆ rotVec

maths::Vector<double> GOAT::raytracing::LightSrc::rotVec =maths::Vector<double>(1,0,0)
protected

Vector which holds the spherical coordinates \(r\), \(\vartheta\) and \(\varphi\) of the direction vector k.

Definition at line 184 of file lightsrc.h.

◆ suppress_phase_progress

bool GOAT::raytracing::LightSrc::suppress_phase_progress = false

if set true, the phase won't be changed when calling a next method (needed for USP-calculations)

Definition at line 175 of file lightsrc.h.

◆ type

int GOAT::raytracing::LightSrc::type

type of the light source

Definition at line 151 of file lightsrc.h.

◆ wvl

double GOAT::raytracing::LightSrc::wvl =1
protected

wavelength

Definition at line 182 of file lightsrc.h.


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