gtrace.optics.geometric

Module Contents

Functions

deflection_angle(theta, n1, n2, deg=True)

Calculate deflection angle according to Snell’s law.

line_plane_intersection(pos, dirVect, plane_center, normalVector, diameter)

Compute the intersection point between a line

line_arc_intersection(pos, dirVect, chord_center, chordNormVect, invROC, diameter, verbose=False)

Compute the intersection point between a line

vector_rotation_2D(vect, angle)

Rotate a 2D vector by an angle.

vector_normalize(vect)

Normalize a vector

normSpheric(normAngle, invROC, dist_from_center)

Returns the local normal angle of a spheric mirror

refl_defl_angle(beamAngle, normAngle, n1, n2, invROC=None)

Returns a tuples of reflection and deflection angles.

cyl_refl_defl_angle(beamAngle, normAngle, n1, n2, invROC=None, curve_direction='h')

Returns a tuples of reflection and deflection angles for incidence of a beam into a cylindrical surface.

vc_deflect(theta, theta1, n1, n2)

Deflection angle helper function for VariCAD.

vc_reflect(theta, theta1)

Convert theta and theta1 to 0-360 format.

Attributes

pi

gtrace.optics.geometric.pi
gtrace.optics.geometric.deflection_angle(theta, n1, n2, deg=True)

Calculate deflection angle according to Snell’s law.

Parameters
  • theta (float) – Angle of incidence.

  • n1 (float) – Refractive index of the first medium.

  • n2 (float) – Refraction index of the second medium.

  • deg (boolean, optional) – True if theta is specified in degrees.

gtrace.optics.geometric.line_plane_intersection(pos, dirVect, plane_center, normalVector, diameter)

Compute the intersection point between a line and a plane

Parameters
  • pos (array) – The position of the end point of the line.

  • dirVert (array) – The directional vector specifying the line.

  • plane_center (array) – The position of the center of the plane.

  • normalVector (array) – The normal vector of the plane.

  • diameter (float) – The diameter of the plane.

Returns

The returned value is a dictionary with the following keys: “Intersection Point”: numpy array of the coordinates of the intersection point. “isHit”: A boolean value of whether the line intersects with the plane or not. “distance”: Distance between the origin of the line and the intersection point. “distance from center”: Distance between the center of the plane and the intersection point.

Return type

dict

gtrace.optics.geometric.line_arc_intersection(pos, dirVect, chord_center, chordNormVect, invROC, diameter, verbose=False)

Compute the intersection point between a line and an arc.

Parameters
  • pos (array) – Origin of the line.

  • dirVect (array) – Direction of the line.

  • chord_center (array) – The center of the chord made by the arc.

  • chordNormVect (array) – Normal vector of the chord.

  • invROC (float) – Inverse of the ROC of the arc. Positive for concave surface.

  • diameter (float) – Length of the chord.

  • verbose (boolean, optional) – Prints useful information.

Returns

The returned value is a dictionary with the following keys: “Intersection Point”: numpy array of the coordinates of the intersection point. “isHit”: A boolean value of whether the line intersects with the plane or not. “distance”: Distance between the origin of the line and the intersection point. “localNormVect”: localNormVect, “localNormAngle”: localNormAngle.

Return type

dict

gtrace.optics.geometric.vector_rotation_2D(vect, angle)

Rotate a 2D vector by an angle.

Parameters
  • vect (array) – A 2D vector.

  • angle (float) – Angle of rotation in radians.

Returns

The rotated vector.

Return type

array

gtrace.optics.geometric.vector_normalize(vect)

Normalize a vector

Parameters

vect (array) – The vector to be normalized

Returns

The normalized vector.

Return type

array

gtrace.optics.geometric.normSpheric(normAngle, invROC, dist_from_center)

Returns the local normal angle of a spheric mirror at a distance from the center.

Parameters
  • normAngle (float) – The angle formed by the normal vector of the mirror at the center and the x-axis.

  • invROC (float) – 1/R, where R is the ROC of the mirror.

  • dist_from_center (float) – The distance from the center of the point where the local normal is requested. This is a signed value. For a mirror facing +x (the normal vector points towards positive x direction), this distance is positive for points with positive y coordinate, and negative for points with negative y coordinate.

Returns

The local normal angle of a spheric mirror at a distance from the center.

Return type

float

gtrace.optics.geometric.refl_defl_angle(beamAngle, normAngle, n1, n2, invROC=None)

Returns a tuples of reflection and deflection angles.

Parameters
  • beamAngle (float) – The angle formed by the propagation direction vector of the incident beam and the x-axis.

  • normAngle (float) – The angle formed by the normal vector of the surface and the x-axis.

  • n1 (float) – Index of refraction of the incident side medium.

  • n2 (float) – Index of refraction of the transmission side medium.

  • invROC (float or None, optional) – Inverse of the radius of curvature.

Returns

  • 6-tuple or 2-tuple

  • (reflAngle, deflAngle, Mrx, Mry, Mtx, Mty) or (reflAngle, deflAngle)

gtrace.optics.geometric.cyl_refl_defl_angle(beamAngle, normAngle, n1, n2, invROC=None, curve_direction='h')

Returns a tuples of reflection and deflection angles for incidence of a beam into a cylindrical surface.

Parameters
  • beamAngle (float) – The angle formed by the propagation direction vector of the incident beam and the x-axis.

  • normAngle (float) – The angle formed by the normal vector of the surface and the x-axis.

  • n1 (float) – Index of refraction of the incident side medium.

  • n2 (float) – Index of refraction of the transmission side medium.

  • invROC (float or None, optional) – Inverse of the radius of curvature.

  • curve_direction (str, optional) – Direction of curvature. Either ‘h’ or ‘v’.

gtrace.optics.geometric.vc_deflect(theta, theta1, n1, n2)

Deflection angle helper function for VariCAD.

Parameters
  • theta (float) – Angle of the surface measured from right.

  • theta1 (float) – Angle of the incident beam measured from right.

  • n1 (float) – Index of refraction of the incident side medium.

  • n2 (float) – Index of refraction of the transmission side medium.

Returns

phi2 – Angle of the deflected beam measured from right.

Return type

float

gtrace.optics.geometric.vc_reflect(theta, theta1)

Convert theta and theta1 to 0-360 format.

Parameters
  • theta (float) – Angle of the surface measured from right.

  • theta1 (float) – Angle of the incident beam measured from right.

Returns

Return type

float