RobinTrace
Public Member Functions | Public Attributes | Friends | List of all members
transfer Class Reference

Transfer operation over a ray. More...

#include <transfer.h>

Public Member Functions

 transfer ()
 Default constructor. More...
 
 transfer (Vec3 _D)
 Translation initialization constructor. More...
 
 transfer (Mat3 _Bt, Vec3 _D)
 Full initialization constructor. More...
 
void apply (ray &r)
 Apply the transfer to a ray. More...
 

Public Attributes

Mat3 Bt
 Transpose of the rotation matrix \( B \). More...
 
Vec3 D
 Translation vector \( D \). More...
 

Friends

std::ostream & operator<< (std::ostream &out, const transfer &trf)
 Printer.
 

Detailed Description

Transfer operation over a ray.

The transfer operation defines a new LCS to propagate the ray to. It operates a change of basis and an intersection with the newly defined local plane. Let, in a hypothetical global common coordinate system,

The definition of LCS2 from LCS1 is done with,

The coordinates of the origin and basis vectors of LCS are expressed with,

\[ \begin{cases} A_2 &= B \cdot \overrightarrow{D} \\ \hat{x_2} &= B \cdot \hat{x_1} \\ \hat{y_2} &= B \cdot \hat{y_1} \\ \hat{z_2} &= B \cdot \hat{z_1} \end{cases} \]

Which is to say, LCS2 is obtained from LCS1 by first applying the rotation \( B \) and then translating the origin by \( \overrightarrow{D} \), with \( D \) expressed in the rotated coordinates.

Constructor & Destructor Documentation

◆ transfer() [1/3]

transfer::transfer ( )

Default constructor.

The defaults are:

  • \( B = B^{-1} = I \), the identity matrix.
  • \( \overrightarrow{D} = 0_3 \), the zero vector.

This transfer operation does not change the current LCS.

◆ transfer() [2/3]

transfer::transfer ( Vec3  _D)

Translation initialization constructor.

The translation vector is initialized to _D, while the rotation matrix \( B \) is identity.

Parameters
_DThe initial transfer translation vector.

◆ transfer() [3/3]

transfer::transfer ( Mat3  _Bt,
Vec3  _D 
)

Full initialization constructor.

The rotation matrix transpose is initialized to _Bt, the translation vector is initialized to _D.

Parameters
_BtThe initial rotation matrix transpose.
_DThe initial translation vector.

Member Function Documentation

◆ apply()

void transfer::apply ( ray r)

Apply the transfer to a ray.

The operation is decomposed into two successive operations on the ray.

  • A change of basis from LCS1 to LCS2.
  • A ray intersection with the local plane of LCS2

Let the ray coordinates in LCS1, \( (P_1, \overrightarrow{V_1}) \). We first operate the change of basis, which gives us ray coordinates \( (P_2, \overrightarrow{V_2}) \).

\[ \begin{cases} P_2 &= \begin{bmatrix} x_2 \\ y_2 \\ z_2 \end{bmatrix} = B^{-1} \cdot P_1 - \overrightarrow{D} \\ \overrightarrow{V_2} &= \begin{bmatrix} l_2 \\ m_2 \\ n_2 \end{bmatrix} = B^{-1} \cdot \overrightarrow{V_1} \end{cases} \]

\( n_2 = 0 \) is an error case, since the ray is parallel to the LCS2 local plane.

We then operate the intersection of the ray with the LCS2 local plane, obtaining \( (P_3, \overrightarrow{V_3}) \).

\[ \begin{cases} \overrightarrow{V_3} = \overrightarrow{V_2} \\ t = - \frac{z_2}{n_2} \\ P_3 = \begin{bmatrix} x_2 + t \cdot l_2 \\ y_2 + t \cdot m_2 \\ 0 \end{bmatrix} \end{cases} \]

Here is the caller graph for this function:

Member Data Documentation

◆ Bt

Mat3 transfer::Bt

Transpose of the rotation matrix \( B \).

Note that since rotation matrices are orthogonal, we have \( B^{-1} = B^\top \).

◆ D

Vec3 transfer::D

Translation vector \( D \).

Note the translation from LCS1 to LCS2 is applied in the rotated coordinates.


The documentation for this class was generated from the following files: