MAPaint Technical Report:
Look up Tables for Display to Image Coordinates

next up previous contents
Next: Fixed Point Constraints Up: Viewing Planes Previous: Up is Up

Look up Tables for Display to Image Coordinates

To make the calculation more efficient we can minimize the number of floating point operations by pre-calculating the trigonometric terms and storing them as look-up tables (LUT). In this case we are transforming from the 2D display frame back to 3D image coordinates and to avoid round-off error we require 6 LUTs for each of x' and y' to (x,y,z). Note x' and y' are always integer coordinates in the display frame. In our coordinate system we want the transform from (x',y',d) to the original image coordinates therefore using equation 6 we get
x = $\displaystyle \frac{1}{s}(R^{-1}_{11} x' + R^{-1}_{12} y' + R^{-1}_{13} d) +
f_x\;,$  
y = $\displaystyle \frac{1}{s}(R^{-1}_{21} x' + R^{-1}_{22} y' + R^{-1}_{23} d) +
f_y\;\;\mbox{and}$ (13)
z = $\displaystyle \frac{1}{s}(R^{-1}_{31} x' + R^{-1}_{32} y' + R^{-1}_{33} d) +
f_z\;.$  

We define LUTs for x' to (x,y,z) which include the constant terms:
Tx'x(x') = $\displaystyle \frac{1}{s}(R^{-1}_{11} x' + R^{-1}_{13} d) + f_x\;,$  
Tx'y(x') = $\displaystyle \frac{1}{s}(R^{-1}_{21} x' + R^{-1}_{23} d) + f_y\;,$ (14)
Tx'z(x') = $\displaystyle \frac{1}{s}(R^{-1}_{31} x' + R^{-1}_{33} d) + f_z\;.$  

and similarly for y' to (x,y,z):
Ty'x(x') = $\displaystyle \frac{1}{s}R^{-1}_{12} y'\;,$  
Ty'y(x') = $\displaystyle \frac{1}{s}R^{-1}_{22} y'\;,$ (15)
Ty'z(x') = $\displaystyle \frac{1}{s}R^{-1}_{32} y'\;.$  

To determine the new section image the transformations can be calculated by look-up plus one addition:

x = $\displaystyle T_{x'x}(x') + T_{y'x}(y')\;,$  
y = $\displaystyle T_{x'y}(x') + T_{y'y}(y')\;,$ (16)
z = $\displaystyle T_{x'z}(x') + T_{y'z}(y')\;.$  

If the viewing direction does not change and only the distance parameter is incremented by $\delta d$ then the y' LUTs are unchanged and the x' LUTs become:

$\displaystyle T_{x'x}(x', d + \delta d)$ = $\displaystyle T_{x'x}(x',d) + \frac{1}{s} R^{-1}_{13} \delta d\;,$  
$\displaystyle T_{x'y}(x', d + \delta d)$ = $\displaystyle T_{x'y}(x',d) + \frac{1}{s} R^{-1}_{23} \delta d\;,$ (17)
$\displaystyle T_{x'z}(x', d + \delta d)$ = $\displaystyle T_{x'z}(x',d) + \frac{1}{s} R^{-1}_{33} \delta d\;.$  

Note R-1 = RT. The LUTs are calculated over the maximum range possible for x' and y' which is determined by forward transform (equation 5) of the bounding box of the original image.


next up previous contents
Next: Fixed Point Constraints Up: Viewing Planes Previous: Up is Up

Richard Baldock
1998-06-05