Description Retrieves the intrinsic parameters of the polarization state of a specified ray. Depending on the number of rays traced, it may be necessary to dimension ray index and ray counter variables as data type Huge_ instead of Long. Please see Multi-threaded Raytracing for more information.
Syntax GetPolarization2 id, polar
Parameters id As Long (or Huge_) Ray identifier.
polar As T_POLARIZE2 Structure containing the intrinsic polarization state data for the specified ray.
Remarks This subroutine retrieves the intrinsic parameters of the polarization state for a specific ray in the ray buffer and stores that data in the parameter polar. If there is a problem, an error is posted and the subroutine returns without modifying polar.
The data returned by GetPolarization2 is at a more fundamental level than the data returned by GetPolarization.
In general, the polarized field is defined as
E = Sqrt(rayflux) × (ap p + as s + ad d) × Exp[i(2p/l)×OPL]
where d is the ray direction and s x p = d,
ap = pAmpReal + i pAmpImag, as = sAmpReal + i sAmpImag, s || p and ad = 0 except in birefringent media.
Example The following script example calculates the real and imaginary components of the E-field along the S, P, global X and global Y directions using the GetPolarization2 subroutine.
Dim pol2 As T_POLARIZE2 Dim ray As T_RAY Dim pi As Double Dim sx As Double, sy As Double, sz As Double Dim px As Double, py As Double, pz As Double Dim dx As Double, dy As Double, dz As Double Dim Esreal As Double, Epreal As Double, Edreal As Double Dim Esimg As Double, Epimg As Double, Edimg As Double Dim ExRe As Double, EyRe As Double Dim ExIm As Double, EyIm As Double Dim thetas As Double, thetap As Double, theta As Double, mags As Double, magp As Double Dim iray As Long, cnt As Long
pi=Acos(-1) ClearOutputWindow
'write header Print "Ray ID"; Print "EsRe"; Print "EsIm"; Print "EpRe"; Print "EpIm"; Print "ExRe"; Print "ExIm"; Print "EyRe"; Print "EyIm"
'loop over all rays in the buffer cnt=0 success=GetFirstRay(iray,ray) While success cnt=cnt+1
'retrieve the d vector, calculate p and the phase GetPolarization2 iray,pol2 sx=pol2.sX : sy=pol2.sY : sz=pol2.sZ dx=ray.a : dy=ray.b : dz=ray.c CrossProd3D px, py, pz,-sx, -sy, -sz, dx, dy, dz theta=2*pi*ray.pathlength/(ray.wavelength*1e-3)
'magnitides of s and p components mags=Sqr(pol2.sAmpReal^2+pol2.sAmpImag^2) magp=Sqr(pol2.pAmpReal^2+pol2.pAmpImag^2)
'relative phase of s and p components thetas=Atn2(pol2.sAmpImag,pol2.sAmpReal) thetap=Atn2(pol2.pAmpImag,pol2.pAmpReal)
'real & imaginary components in s and p directions Esreal=Sqr(ray.power)*mags*Cos(theta+thetas) : Esimg=Sqr(ray.power)*mags*Sin(theta+thetas) Epreal=Sqr(ray.power)*magp*Cos(theta+thetap) : Epimg=Sqr(ray.power)*magp*Sin(theta+thetap)
'real & imaginary components in the x and y directions ExRe = Esreal*pol2.sX + Epreal*px EyRe = Esreal*pol2.sY + Epreal*py ExIm = Esimg*pol2.sX + Epimg*px EyIm = Esimg*pol2.sY + Epimg*py
'print data to Output Window Print iray; Print Esreal; Print Esimg; Print Epreal; Print Epimg; Print ExRe; Print ExIm; Print EyRe; Print EyIm
success=GetNextRay(iray,ray) Wend
See Also
|