IRayTraceNSCData
In non-sequential mode, there is one trace mode IRayTraceNSCData.
When opening the tool, the user selects the number of maximum rays to be traced, the maximum number of segments for each individual rays and the coherence length.
CreateNSC (int MaxRays, int maxSegments, double coherenceLength)
The rays are then defined one by one in the AddRay function.
AddRay (int waveNumber, int surf, NSCTraceOptions mode, double X, double Y, double Z, double L, double M, double N, int InsideOf, double exr, double exi, double eyr, double eyi, double ezr, double ezi)
The rays are defined:
- int waveNumber : the wavelength associated with the wavenumber
- int surf: the surface at which to start the ray tracing
- NSCTraceOptions : the non-sequential options to trace the rays. There are 8 options. The 4 last options have been added because Matlab/Python don't support .NET enums correctly. For C# and C++, the 4 first options can be combined using a bitwise OR operator:
- None
- UsePolarization
- UseSplitting
- UseScattering
- UsePolarizationSplitting
- UsePolarizationScattering
- UseSplittingScattering
- UsePolarizationSplittingScattering
- double X, Y, Z: coordinates of the ray on the starting surface
- double L, M, N: direction cosines of the ray on the starting surface
- int InsideOf: it indicates if the starting surface is inside an object. If in air, InsideOf =0, otherwise it is equal to the object it is inside of.
- double exr, exi, eyr, eyi, ezr, ezi : the electric of the ray on the starting surface
Note that the input intensity is always assumed to be equal to 1.0. So the e-field magnitude (if used) should also be 1.0.
If we use polarization in the ray tracing (NSCTraceOptions = UsePolarization), the initial electric field values must be provided. The user application must ensure the defined vector is orthogonal to the ray propagation vector, and that the resulting intensity matches the starting intensity value, otherwise incorrect ray tracing results will be produced.
Results
There are two methods to return the results: one to read ray by ray, and then one to read segment by segment:
ReadNextResult (out int rayNumber, out int ErrorCode, out int wave, out int numSegments)
ReadNextSegment (out int segmentLevel, out int segmentParent, out int hitObj, out int InsideOf, out double X, out double Y, out double Z, out double L, out double M, out double N, out double exr, out double exi, out double eyr, out double eyi, out double ezr, out double ezi, out double intensity, out double pathLength)
- rayNumber
- ErrorCode
- wave
- numSegments: number of segments of the ray
- segmentLevel
- segmentParent
- hitObj
- InsideOf
- double X, out double Y, out double Z
- double L, out double M, out double N
- double exr, out double exi, out double eyr, out double eyi, out double ezr, out double ezi
- intensity: relative transmitted intensity of the ray
- double intensity
- double pathLength
Next: