Commit things
[ipdf/sam.git] / chapters / Background / CoordinateSystems.tex
index 3a61cb3..ab3fbcd 100644 (file)
@@ -1,53 +1,51 @@
 Basic vector primitives composed of B{\'e}ziers may be rendered using only integer operations, once the starting and ending positions are rounded to the nearest pixel.
 
-However, a complete document will contain many such primitives which in general cannot all be shown on a display at once. A ``View'' rectangle can be defined to represent the size of the display relative to the document. To interact with the document a user can change this view through scaling or translating with the mouse\cite{}.
+However, a complete document will contain many such primitives which in general cannot all be shown on a display at once. A ``View'' rectangle can be defined to represent the size of the display relative to the document. To interact with the document a user can change this view through scaling or translating with the mouse.
 
-Primitives which are contained within the view rectangle will be visible on the display. This involves the transformation from coordinates within the document to relative coordinates within the view rectangle as illustrated in Figure \ref{}. A point $(X,Y)$ in the document will transform to a point $(x,y)$ in the view by:
+Primitives which are contained within the view rectangle will be visible on the display. This involves the transformation from coordinates within the document to relative coordinates within the view rectangle as illustrated in Figure \ref{view_transformation_minimal.pdf}. A point $(X,Y)$ in the document will transform to a point $(S_X,S_Y)$ in the display by:
 \begin{align}
-       X = \frac{x - v_x}{v_w} &\quad\quad Y = \frac{y - v_y}{v_h}\label{view-transformation}
+       S_X = \frac{X - V_x}{V_w} &\quad\quad S_Y = \frac{Y - V_y}{V_h}\label{view-transformation}
 \end{align}
-Where $(v_x,v_y)$ are the coordinates of the top left corner and $(v_w,v_h)$ are the dimensions of the view rectangle.
+Where $(V_x,V_y)$ are the coordinates of the top left corner and $(V_w,V_h)$ are the dimensions of the view rectangle.
 
 
-The transformation may also be written as a 3x3 matrix $\matx{V}$ if we introduce a third coordinate $Z = 1$
+The transformation may also be written as a 3x3 matrix $\matx{V}$ if we introduce a third coordinate $z = 1$
 \begin{align}
-       \matx{X} &= \matx{V} \matx{x} \\
-       \left( \begin{array}{c} X \\ Y \\ 1 \end{array}\right) &= 
+       \left( \begin{array}{c} S_X \\ S_Y \\ 1 \end{array}\right) &= 
        \left( \begin{array}{ccc} 
-               \frac{1}{v_w} & 0 & \frac{v_x}{v_w} \\
-               0 & \frac{1}{v_h} & \frac{v_y}{v_h} \\
+               \frac{1}{V_w} & 0 & \frac{V_x}{V_w} \\
+               0 & \frac{1}{V_h} & \frac{V_y}{V_h} \\
                0 & 0 & 1 
        \end{array}\right) 
-       \left( \begin{array}{c} x \\ y \\ 1 \end{array}\right)\label{view-transformation-matrix}
+       \left( \begin{array}{c} X \\ Y \\ 1 \end{array}\right)\label{view-transformation-matrix}
 \end{align}
 
 
+\begin{figure}[H]
+       \centering
+       \includegraphics[width=0.7\textwidth]{figures/view_transformation_minimal.pdf}
+       \caption{Illustration of view transformation \eqref{view-transformation}}\label{view_transformation_minimal.pdf}
+\end{figure}
+
+\subsection{View Transformations}
 
 Moving the mouse\footnote{or on a touch screen, swiping the screen} by a distance $(\Delta x, \Delta y)$ relative to the size of the view should translate it by the same amount\cite{}:
 \begin{align}
-       v_x \to v_x + \Delta x \\
-       v_y \to v_y + \Delta y
+       V_x \to V_x + \Delta x \\
+       V_y \to V_y + \Delta y
 \end{align}
 
 The document can be scaled by a factor of $s$ about a point $(x_0,y_0)$ specified relative to the view (such as the position of the mouse cursor)\cite{}:
 \begin{align}
-       v_x \to v_x + x_0 v_w(1 - s) \\
-       v_y \to v_y + y_0 v_h(1 - s) \\
-       v_w \to s v_w \\
-       v_h \to s v_h
+       V_x \to V_x + x_0 V_w(1 - s) \\
+       V_y \to V_y + y_0 V_h(1 - s) \\
+       V_w \to s V_w \\
+       V_h \to s V_h
 \end{align}
 
 The effect of this transformation is that, measured relative to the view rectangle, the distance of primitives with coordinates $(x, y)$ to the point $(x_0, y_0)$ will decrease by a factor of $s$. For $s < 1$ the operation is ``zooming out'' and for $s > 1$, ``zooming in''.
 
 
-{\bf TODO}
-\begin{itemize}
-       \item Intermediate coordinate systems...
-       \item Write Matrix operations properly
-       \item Link with the results where applying \eqref{view-transformation} directly leads to disaster
-       \item This is because for $v_w << 1$, an error of $1 ulp$ in $x - v_x$ is comparable with $v_w$, ie: Can increase to the order of the size of the display (or more)
-\end{itemize}
-
 %TODO List
 % Mention that these transformations affect precision more than eg: drawing a line
 % Discuss floating point errors that could occur?

UCC git Repository :: git.ucc.asn.au