CWO++library  0.32
 All Classes Functions Variables Groups
Functions
Operations for complex amplitude

Functions

void CWO::Re ()
 Taking only the real part of complex amplitude.
void CWO::Im ()
 Taking only the imaginary part of complex amplitude.
void CWO::Conj ()
 Calculating the complex conjugation of complex amplitude.
void CWO::Intensity ()
 Calculating the absolute square (light intensity) of complex amplitude.
void CWO::Amp ()
 Calculating the amplitude of complex amplitude.
void CWO::Phase (float offset=0.0f)
 Calculating complex amplitude with the constant amplitude .
void CWO::Arg (float scale=1.0f, float offset=0.0f)
 Calculating the argument of complex amplitude with real value from $-\pi$ to $+\pi$.
.
void CWO::Expi ()
void CWO::Arg2Cplx (float scale=1.0, float offset=0.0)
void CWO::Cart2Polar ()
void CWO::Polar2Cart ()
void CWO::ReIm (CWO &re, CWO &im)
 replace the real and imaginary parts.


Detailed Description


Function Documentation

void CWO::Re ( )

Taking only the real part of complex amplitude.

   @note 

$ Re[a] \leftarrow Re[a] $
$ Im[a] \leftarrow 0 $

Examples:
Amplitude CGH.
void CWO::Im ( )

Taking only the imaginary part of complex amplitude.

   @note 

$ Re[a] \leftarrow Im[a] $
$ Im[a] \leftarrow 0 $

void CWO::Conj ( )

Calculating the complex conjugation of complex amplitude.

   @note 

$ Re[a] \leftarrow Re[a] $
$ Im[a] \leftarrow -Im[a]$

void CWO::Intensity ( )

Calculating the absolute square (light intensity) of complex amplitude.

   @note 

$ Re[a] \leftarrow Re[a]^2+Im[a]^2 $
$ Im[a] \leftarrow 0 $

Examples:
Phase shifting digital holography, Shifted-Fresnel diffraction, simple_diffraction.cpp, simple_diffraction_with_gpu.cpp, and Using CPU threads.
void CWO::Amp ( )

Calculating the amplitude of complex amplitude.

   @note 

$ Re[a] \leftarrow \sqrt{Re[a]^2+Im[a]^2} $
$ Im[a] \leftarrow 0 $

void CWO::Phase ( float  offset = 0.0f)

Calculating complex amplitude with the constant amplitude .

   @param offset : adjust the phase distribution
   @note

$ \theta=\tan^{-1}\frac{Im[a]}{Re[a]} $
$ Re[a] \leftarrow \cos(\theta) $
$ Im[a] \leftarrow \sin(\theta) $

void CWO::Arg ( float  scale = 1.0f,
float  offset = 0.0f 
)

Calculating the argument of complex amplitude with real value from $-\pi$ to $+\pi$.
.

   @param scale : adjust scale, ex. if setting scale=1.0, the phase range is \f-$\pi\f to + \form#21. if setting scale=1/\f-2$\pi\f, the phase range is -0.5 to +0.5.
   @param offset : adjust the phase range, ex. if setting offset=CWO_PI, the phase range in the phase distribution is 0 to \form#13.
   @note 

$ Re[a] \leftarrow tan^{-1}(\frac{Im[a]}{Re[a]})+offset $
$ Im[a] \leftarrow 0 $

//sample code of generating kinoform
CWO a;
a.Load("test.bmp");
a.Diffract(0.1);
a.Arg();//This kinoform has the argument range of -pi to +pi
a.SaveAsImage("kinoform.bmp",CWO_SAVE_AS_RE);
//sample code of generating kinoform.
CWO a;
a.Load("test.bmp");
a.Diffract(0.1);
a.Arg(CWO_PI);//This kinoform has the argument range of 0 to 2pi
a.SaveAsImage("kinoform.bmp",CWO_SAVE_AS_RE);
Examples:
Kinoform.
void CWO::Expi ( )

I do not recommend to use this function. I will abolish the function in future CWO++ library.

void CWO::Arg2Cplx ( float  scale = 1.0,
float  offset = 0.0 
)

Convering argument (real value) to complex amplitude.
Concreately, the following calculation is done.

    @param offset : .
    @note 

$ Re[a] \leftarrow tan^{-1}(\frac{Im[a]}{Re[a]})+offset $
$ Im[a] \leftarrow 0 $

//sample code of generating kinoform
CWO a;
a.Load("test.bmp");
a.Diffract(0.1);
a.Arg();//This kinoform has the argument range of -pi to +pi
a.SaveAsImage("kinoform.bmp",CWO_SAVE_AS_RE);
void CWO::ReIm ( CWO re,
CWO im 
)

replace the real and imaginary parts.

   @param re : 
   @param im : 
   @note
   CWO a @n

$ Re[a] \leftarrow Re[re] $
$ Im[a] \leftarrow Re[im] $

//The real and imaginary parts of c[2] are replaced by the real parts of c[0] and c[1], respectively
CWO c[3];
c[2].ReIm(c[0],c[1]);
Examples:
Phase shifting digital holography.