System4f.mul_ray

raytracing.System4f.mul_ray(self, rightSideRay)

This function does the multiplication of a ray by a matrix. The output shows the propagated ray through the system. New position of ray is updated by the physical length of the matrix.

Parameters:

rightSideRay (object from Ray class) – including the Ray properties

Returns:

outputRay – New position of the input ray after passing through the element.

Return type:

an object from Ray class

Examples

A propagation of a ray at height 10 with angle 10 can be written as the following:

>>> from raytracing import *
>>> # M1 is an ABCD matrix of a lens (f=10)
>>> M1= Matrix(A=1,B=0,C=-1/10,D=1,physicalLength=5,label='Lens')
>>> # R is a ray
>>> R= Ray(y=10,theta=10)
>>> print('The output ray of Lens M1:\n' , M1.mul_ray(R))
The output ray of Lens M1:
 y = 10.000
theta =  9.000
z = 5.000

And after a free space (d=2)

>>> # M2 is an ABCD matrix of free space (d=2)
>>> M2= Matrix(A=1,B=2,C=0,D=1,physicalLength=2,label='freeSpace')
>>> M=M1.mul_matrix(M2)
>>> print('The output ray of Lens M1 and free space M2:\n' , M.mul_ray(R))
The output ray of Lens M1 and free space M2:
 y = 30.000
theta =  7.000
z = 7.000

Notes

If the ray is beyond the aperture diameter it is labelled as “isBlocked = True” but the propagation can still be calculated.