These examples cover the FRED Ray Data Retrieval/Setting scripting commands: "Get" - get specific ray data, "Is" - confirm/deny certain ray properties, "Set" - set specific ray data
The structures listed below contain parameters required for these ray data commands:
The Ray Data Retrieval/Setting commands allow for easy access to a large number of individual ray properties including •position •direction •initial*/current power •wavelength •ancestory* •polarization •coherence •entity* •material* •number of intersections* •source* •path* •pathlength •scatter/specular depth* •surface normal* •entity array indicies*
*Note that some of the above properties can only be retieved by the Get/Set method.
"Get/Set" ray data
Use the "Get" and "Set" commands in combination to query rays and change their status.
For example, find the polarization state of ray(s) and change them:
Dim p As T_POLARIZE GetPolarization 25, p Print p.ellipticity p.ellipticity=p.ellipticity/2 SetPolarization 25,p
or, to query wavelength and change it under some condition,
Dim ray As T_RAY Dim i& success = GetFirstRay(i,ray) While success If ray.wavelength<0.532 Then SetRayWavelength i, 0.532 End If success = GetNextRay(i,ray) Wend
Finally, to query and change the number of parabasal rays associated with a given base ray,
Dim ray As T_RAY Dim rc As T_RAYCOHERENT Dim rayscale#,raycount&, i& rc.secondaryRayCount=8
success = GetFirstRay(i,ray) While success GetRayCoherent i, rayscale, raycount If raycount<8 Then SetRayCoherent i, rc End If success = GetNextRay(i,ray) Wend
Important: Confirm that the other parameters associated with T_COHERENT are consistent with each ray's current settings.
"Is" status
The "Is" commands query rays for certain information requiring only a True or False answer:
To find whether ray 500 is active (traceable), ans1=IsRayActive(500)
or to find whether ray 100 is polarized, ans2=IsPolarized(100)
or to find whether ray 3000 is currently on an entity array,
ans3=IsRayOnEntityArray(3000)
Use these commands to examine the entire ray buffer in cases where the buffer contains multiple sources. See Also….
|