Restructure chapters, delete a bunch of words, add more words, do some things, panic...
[ipdf/sam.git] / chapters / Results.tex
1 \chapter{Results and Discussion}
2
3
4 \section{Qualitative Rendering Accuracy}
5         
6 Our ultimate goal is to be able to insert detail at an arbitrary point in the document. Therefore, we are interested in how the same test SVG would appear when scaled to the view coordinates, as the view coordinates are varied. 
7
8 applying Transformation \eqref{view-transformation}. We will use single precision floats for coordinates unless otherwise stated.
9
10 Figure \ref{qualitative-rendering-fox} shows the rendering of a vector image\footnote{Unfortunately, since a rendered vector image is a raster image and this figure must be scaled to fit the PDF, the figure as seen here is not a pixel perfect representation of the actual rendering. Most notably, antialiasing effects will be apparent}. Transformation \eqref{view-transformation} is applied to object coordinates with default IEEE-754 rounding behaviour (to nearest).
11
12
13
14 \begin{figure}[H]
15         \centering
16         \includegraphics[width=800px]{figures/fox-vector_screenshot2.png}
17         \includegraphics[width=800px]{figures/fox-vector_highzoom1.png}
18         \caption{The vector image from Figure \ref{vector-vs-raster} under two different scales}\label{qualitative-rendering-fox}
19 \end{figure}
20
21 Rather than applying \eqref{view-transformation} to object coordinates specified relative to the document, we can store the bounds of objects relative to the view and modify these bounds according to transformations \eqref{} and \eqref{} as the view is changed. This approach significantly improves the range over which an image can be rendered correctly, and it is convenient for interactively created documents as no transformation must be applied to add new detail. 
22
23 However, repeated transformations on the view will cause an accumulated error on the coordinates of object bounds. This is most noticable when zooming out and then back into the document; the object bounds coordinates will gradually underflow and eventually round to zero. An example of this effect is shown in Figure \ref{qualitative-rendering-fox-cumulative} b)
24 %label start
25 %setbounds 0.5 0.5 1e-6 1e-6
26 %loadsvg svg-tests/fox-vector.svg
27 %loop 1950 pxzoom 0 0 -1
28 %loop 200 wait
29 %debug hi
30 %loop 1950 pxzoom 0 0 1
31 %wait
32 \begin{figure}[H]
33         \centering
34         \includegraphics[width=800px]{figures/fox-vector_cumulative_before_transforms.png}
35         \includegraphics[width=800px]{figures/fox-vector_cumulative_after_transforms.png}
36         \caption{The effect of applying cumulative transformations to all B\'{e}ziers}\label{qualitative-rendering-fox-cumulative}
37 \end{figure}
38
39 In Figure \ref{qualitative-rendering-fox}, transformations are applied to the bounds of each B\'{e}zier. Figure \ref{qualitative-rendering-fox-cumulative-relative} a) shows the effect of introducing an intermediate coordinate system expressing B\'{e}zier coordinates relative to the path which contains them. In this case, the rendering of a single path is accurate, but the overall positions of the paths drift. 
40
41 We can correct this drift whilst maintaining performance by using an arbitrary precision number representation to express the coordinates of the paths - but maintaining the floating point coordinates for B\'{e}zier curves relative to their path. As we will discuss in Section \ref{}, this offers an acceptable trade off between rendering accuracy and performance.
42
43 \begin{figure}[H]
44         \centering
45         \includegraphics[width=800px]{figures/fox-vector_cumulative_relative_to_path.png}
46         \includegraphics[width=800px]{figures/fox-vector_cumulative_relative_to_path_GMPrat.png}
47         \caption{Effect of cumulative transformations applied to Paths\\a) Path bounds represented using floats b) Path bounds represented using Rationals}\label{qualitative-rendering-fox-cumulative-relative}
48 \end{figure}
49         
50 \section{Quantitative Measurements of Rendering Accuracy}
51         
52 A useful test SVG is a simple grid of horizontal and vertical lines seperated by 1 pixel. When this SVG is correctly scaled to a view, all that should be visible is a coloured rectangle filling the screen. Increasing the magnification will reveal the grid of lines indicating how the original size of a pixel is scaled.
53
54 Figures \ref{} show the effect of scaling the grid to different view coordinates using single precision. This illustrates the trade off between precision and range; as the top left corner of the view moves further away from the origin, the width for which the grid appears unaltered decreases, or if the width is kept fixed, then there are fewer locations on the grid that can be correctly transformed from document to view space.
55
56 Figure \ref{} shows a plot of the number of lines visible in the grid as a function of distance from the origin for IEEE-754 floats and several different precision settings for the MPFR library. 
57
58 Figure \ref{} shows the obvious 
59         
60 \section{Performance Measurements whilst Rendering}
61         
62 As discussed above, we succeeded in preserving rendering accuracy as defined above for an arbitrary view.
63 However this comes at a performance cost, as the size of the number representation must grow accordingly.
64
65
66

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