coordinate_system

Coordinate System Module

This module provides standard coordinate system transformation calculations. The CoordinateSystem class represents a coordinate system in 3D space and provides methods for localizing and globalizing rays. This class is used to define the position and orientation of all optical surfaces in an optical system.

Kramer Harrison, 2024

Classes

CoordinateSystem([x, y, z, rx, ry, rz, ...])

Represents a coordinate system in 3D space.

class CoordinateSystem(x: ScalarOrArray = 0, y: ScalarOrArray = 0, z: ScalarOrArray = 0, rx: ScalarOrArray = 0, ry: ScalarOrArray = 0, rz: ScalarOrArray = 0, reference_cs: CoordinateSystem | None = None)[source]

Represents a coordinate system in 3D space.

x

The x-coordinate of the origin.

y

The y-coordinate of the origin.

z

The z-coordinate of the origin.

rx

The rotation around the x-axis.

ry

The rotation around the y-axis.

rz

The rotation around the z-axis.

reference_cs

The reference coordinate system.

classmethod from_dict(data: dict) CoordinateSystem[source]

Create a coordinate system from a dictionary.

Parameters:

data – The dictionary representation of the coordinate system.

Returns:

The coordinate system instance defined by the provided dictionary.

get_effective_rotation_euler() NDArray[np.floating][source]

Get the effective rotation in Euler angles.

The Euler angles are returned in ‘xyz’ order.

Returns:

A NumPy array containing the effective rotation as Euler

angles (rx, ry, rz). Note: This returns a NumPy array due to the use of SciPy for the conversion.

get_effective_transform() tuple[BEArray, BEArray][source]

Get the effective translation and rotation matrix of the CS

Returns:

A tuple containing the effective translation and rotation matrix

get_rotation_matrix() BEArray[source]

Get the rotation matrix of the coordinate system

Returns:

The rotation matrix of the coordinate system.

globalize(rays: RealRays)[source]

Globalizes the rays from the coordinate system.

Parameters:

rays – The rays to be globalized.

localize(rays: RealRays)[source]

Localizes the rays in the coordinate system.

Parameters:

rays – The rays to be localized.

property position_in_gcs: tuple[BEArray, BEArray, BEArray]
Returns the position of the coordinate system in the global coordinate

system.

Returns:

A tuple containing the x, y, and z coordinates of the position.

property rx: BEArray

The rotation around the x-axis, as a backend array.

property ry: BEArray

The rotation around the y-axis, as a backend array.

property rz: BEArray

The rotation around the z-axis, as a backend array.

to_dict() dict[source]

Convert the coordinate system to a dictionary.

Returns:

The dictionary representation of the coordinate system.

property x: BEArray

The x-coordinate of the origin, as a backend array.

property y: BEArray

The y-coordinate of the origin, as a backend array.

property z: BEArray

The z-coordinate of the origin, as a backend array.