This class represents an arbitrary number of light rays. The reason for having them wrapped in a single class is that it allows full vectorization of the raytracing procedure.
This class shall be used in a disposable fashion, as it is not possible to eliminate rays from it, etc.
Methods
This method is used to append new rays in the bundle.
Parameters : | initialVector : numpy.ndarray \((N,3)\)
initialPosition : numpy.ndarray \((N,3)\)
wavelength : numpy.ndarray \((N)\)
|
---|
Notes
Examples
>>> bundle = RayBundle()
>>> bundle.append(np.array([1,0,0]), np.array([0,0,0]))
>>> bundle.append(np.array([[1,0,0],[1,0,0]]),
... np.array([[0,0,0],[0,0,1]]))
>>> bundle.append(np.array([[1,0,0],[0,1,0]],
... np.array([0,0,0]))
This method is not implemented, and is present only to respect the Assembly interface. As deleting a single ray requires many matrix reshapings, it is better to clear all the data and redo the ray tracing.
Raises : | NotImplementedError : |
---|
A (N) matrix with references to the object at the last point of each ray. If no object is at this point, None is returned
A numpy.ndarray with the shape (N,3) with the starting vectors of the N rays in the bundle
Defines the maximum ray length during ray tracing
Memory is pre allocated to increase ray tracing performance. The number of pre allocated steps is defined here. Reallocation is very expensive, so a wise definition of this parameter is needed
Stores references to the objects that each ray intersects. This is a (M,N) pointer matrix. M is the number of allocated steps and N is the number of rays in the bundle
Stores in a (N,3) matrix the last vector of each ray. This is used as a transition matrix and also in the case where ray tracing is to be restarted
A (N) matrix with the length of each ray, calculated from its origin. If the ray does not intersect anything at this step, the value None will be stored
The points followed by each ray. The ray path matrix is organized as a 3D matrix, with the first index being the simulation step, the second is the ray number and the third is the coordinate. So the shape is (M,N,3), with M the number of allocated steps, N the number of rays in the bundle and 3 as the number of spatial coodinates
This method rotates the starting points and deletes all ray tracing data, because a rotation or a translation of light rays may completely change the light paths.
Parameters : | angle :
axis : numpy.ndarray \((1, 3)\)
pivotPoint : numpy.ndarray \((1, 3)\)
|
---|
A numpy.ndarray with the shape (N,3) with the starting points of the N rays in the bundle
Defines the maximum length of a segment of ray during the tracing procedure (should be kept as long as possible to save computational time unless a special purpose tracing is needed)
The number of tracing steps executed to the moment
A method for starting ray tracing. The bundle must be included in the environment assembly where ray tracing will be done (the position, however, is not important)
Parameters : | tracingRule :
|
---|---|
Raises : | RuntimeError :
|
This method changes the rays starting points, and waits for clear data to delete all ray tracing related information.
Parameters : | translation : numpy.ndarray \((3)\)
|
---|
Defines the light wavelength of the rays. This is important in the cases where materials with chromatic dispersion are used