Creating function to map one rectangle in space to another

132 Views Asked by At

There are $2$ rectangles $R_a$ and $R_b$ in space.

$R_a$ can be defined by $x_{ai}, y_{ai}, z_{ai}$ for $i = 1...4$.

$R_b$ can be defined by $x_{bi}, y_{bi}, z_{bi}$ for $i = 1...4$.

How can I create a function $f(x_a, y_a, z_a)$ that maps a point inside $R_a$ to its corresponding point in $R_b$?

  • $R_a$ and $R_b$ have the same aspect ratio

  • $x_{ai}$ corresponds to $x_{bi}$

  • $R_a$ and $R_b$ are randomly placed in the world and may not have the same size