7.2. Rays and light particles
In a – not entirely accurate – analogy to quantum mechanics, the term “light particle” is used alongside the term “ray” below. It is helpful to have the concept of light particles in mind when scattering events are considered in raytracing, while the concept of rays is useful to describe linear propagation. The term light particle does, however, not refer to a specific physical entity but to the sampling entity used in the implementation, as the ray is sequentially traced in the form of a sample from its generation over scattering events to absorption. The term photon is avoided, as it relates to the quantum dynamic nature of light, which can, of course, not be considered here in full. The energies of photons further depend on their wavelengths, whereas the introduced light particles are defined as being equienergetic, i.e. each sample represents the same constant flux density fraction, regardless of its wavelength. Beyond that, a Stokes vector is assigned to each light particle to describe its polarisation state. As discussed above (sections 4.2.4 and 4.8.1), the Stokes vector describes the polarisation state of a multitude of photons, or wave trains, in a statistical nature. Hence, the light particles introduced here can be best described as a fraction of a parallel light beam consisting of many photons with the same wavelength and a specified constant radiant flux density.
In the implementation, the following type definitions are used to describe the ray/light particle:

In the implementation, a light particle or ray sample is defined by the type TStokesRay in the global module RC_Vects. It includes the current position and direction (rp, rdir), the polarisation state Stokes vector (pState) and reference axis (spol) and the wavelength (wl).
It carries information on the current (curColl) and most recent scattering event (lastColl), as well as an ordinal counter that tracks the collisions (collCn). It further contains four variables that are used to increase the performance of the collision detection algorithm.
The two encapsulated Tcollision instances contain information regarding the location, orientation and character of the two most recent object collisions representing scattering events (reflection or transmission).