Navigation: Scripting Reference Manual > Functions & Subroutines > AddScriptGRINMaterial

 

AddScriptGRINMaterial

 

Contact Us: fredsupport@photonengr.com

 

Description

Adds a scripted GRIN material to the Materials Tree.

 

Syntax

id = AddScriptGRINMaterial ( scriptText )

 

Parameters

id (Long)

The identifier of the new scripted material.

 

scriptText As String

This string contains the text (the code) that will be executed by the scripted GRIN material.

 

Remarks

AddScriptGRINMaterial adds a Script GRIN material to the Material Tree. Note that this scripted material need not be a GRIN. Other possibilities include inhomogeneous absorption/gain and dispersive materials.

 

The script defines a function N(x,y,z) for the scripted material. FRED supplies the input variables g_x, g_y, g_z (x,y,z coordinates) and g_w (wavelength in microns). The point (x,y,z) is expressed in the local coordinate system of the material. The scripted material outputs the refractive index value N(x,y,z) in variable g_N,  the imaginary refractive index value in variable g_Nimag. The user must supply the three spatial derivatives of N(x,y,z) as variables g_dNdx, g_dNdy, and g_dNdz.
 

For example, to define a material whose index is quadratic in both x & y:

 

' Wood Lens example: N(x,y,z) = N0 + A(x*x+y*y):


    N0=1.5 : A=-0.01
  g_N = N0 + A*(g_x*g_x + g_y*g_y)
  g_dNdx = 2*A*g_x
  g_dNdy = 2*A*g_y
  g_dNdz = 0
 

 

See Also

SetScriptGRINMaterial

GetScriptGRINMaterialScript

 

Examples

Materials

 

 

 

 

 

Copyright © Photon Engineering, LLC