Coordinate system#

Spherical coordinate system#

../../_images/spherical_cs.svg

Figure 1: radius, polar angle, azimuth. In ray tracing, the plane (Oxy) is tangent to the surface and the (Oz) is normal to the surface. Source: Wikimedia.#

arim uses the physics (ISO) convention for the spherical coordinate system (Wikipedia article)

The radius \(r\) is in the range \([0, +\infty[\) The polar angle theta \(\theta\) (theta) is in the range \([0, \pi]\). The azimuth \(\varphi\) (phi) is in the range \([-\pi, \pi]\).

\[\begin{split}\begin{align} r&=\sqrt{x^2 + y^2 + z^2} \\ \theta &= \arccos\frac{z}{\sqrt{x^2 + y^2 + z^2}} = \arccos\frac{z}{r} \\ \varphi &= \arctan \frac{y}{x} \end{align}\end{split}\]

where arctan returns an angle in the appropriate quadrant (atan2).

Coordinate system in ray tracing#

For ray tracing, a Cartesian coordinate system is attached to each interface point (this includes probe elements, the walls and the grid). This coordinate system must be defined such as the plane (Oxy) is tangent to the surface of the probe elements or walls and the axis (Oz) (either (Oz+) or (Oz-)) points is normal to the surface. There is no such constraints for the grid points.

In order to retrieve the angles of incidence and/or transmission of a ray at an interface, it is convenient to express the coordinates of the incident leg (incoming leg) and the refracted/transmitted leg (outgoing leg) in the coordinate system attached to the interface point through which the ray goes.

Angles of incidence, reflection, transmission#

Angle of the incoming legs: more or less angle of incidence. Angle of the outgoing legs: more or less angle of reflection and transmission.

The incoming leg is defined as a vector whose origin is the interface point and whose end is the source point (upstream in the ray) of the leg. Its coordinates \((r, \theta, \phi)\) are given in the coordinate system attached to the interface point.

The unsigned angle of incoming leg is the polar angle \(\theta\). It is in the range \(\left[0, \pi\right]\).

The signed angle of incoming leg, which has values in \(\left[-\pi, \pi\right]\), is defined as follow:

\[\begin{split}\begin{align} \theta' &= \begin{cases} \theta & \mbox{if } \varphi \in \left]-\frac{\pi}{2}, \frac{\pi}{2}\right] \mbox{ (mod } 2\pi \mbox{)}\\ -\theta & \mbox{otherwise} \end{cases} \end{align}\end{split}\]

The conventional angle of incidence, which has values in \(\left[0, \pi\right]\), takes into account the direction of the user-defined normal which could be either (Oz+) or (Oz-):

\[\begin{split}\begin{align} \theta'' &= \begin{cases} \theta = \arccos\frac{z}{r} & \mbox{if the conventional surface normal is } (Oz^+)\\ \pi - \theta = \arccos\frac{-z}{r} & \mbox{if the conventional surface normal is } (Oz^-) \end{cases} \end{align}\end{split}\]

The conventional surface normal for incoming rays is set up in the attribute arim.core.Interface.are_normals_on_inc_rays_side: True if (Oz+), False if (Oz-).

The angles of outgoing legs are defined similarly with the exception that the outgoing leg is a vector whose origin is the interface point and its end is the destination point (downstream in the ray). The conventional surface normal for outgoing rays are defined arim.core.Interface.are_normals_on_out_rays_side.

../../_images/unsigned_angles.svg

Unsigned angles in plane (Oxz).#

../../_images/signed_angles.svg

Signed angles in plane (Oxz).#

../../_images/conv_angles_plus.svg

Conventional angles in plane (Oxz) with surface normal along (Oz+).#

../../_images/conv_angles_minus.svg

Conventional angles in plane (Oxz) with surface normal along (Oz-).#

See also

arim.geometry