\chapter{Conclusion}\label{Conclusion}
\section{Work Achieved}
In this project we have explored and identified the issues limiting precision in vector graphics formats.
A primitive such as a B\'{e}zier curve can be decomposed into straight lines and rendered on a display to sub-pixel accuracy using IEEE-754 floating point representations, but creating a document using coordinates specified with a floating point representation limits the locations at which detail can be included.
By implementing a proof of concept SVG viewer, we have shown how the approach to applying coordinate transformations affects the accuracy of rendering. Using arbitrary precision GMP rationals to form the coordinates of SVG path elements, expressing B\'{e}zier bounds relative to the paths, we have demonstrated the ability to reduce rendering error and include detail accross an extremely large scale. Performance tests show that this implementation is comparable to a straight forward implementation for a very large number of B\'{e}zier's in the document.
\section{Limitations and Future Work}
As seen in Figure \ref{cumulative_error_grid.pdf} the error for an implementation based on GMP rationals and path coordinates still increases very slowly with scaling, as the final transformation requires conversion to IEEE-754 floats. Our tests have typically been limited to ranges of values represented by IEEE-754 double precision floats, due to time constraints. Future work should address this gradual accumulation of error, particularly outside the range of IEEE-754 values.
Another limitation of our implementation is that only straight lines with starting and ending coordinates in the display will be rendered accurately using Bresenham's algorithm. When ``zooming in'' to a point within a path, the size of lines increases beyond that of the display, and a rounding error is present. This may be a minor problem unless the view is scaled to an intersection point of lines, in which case the intersection may move. Future work should explore this issue.
The MPFR arbitrary precision floating point implementation allows for individually altering the precision of a number. As an alternative to GMP rationals, which automatically increase in size as needed, algorithms for dynamically increasing the precision of MPFR floats could be explored.
Gow has been exploring a spatial approach to constructing a document, which allows detail to be scaled indefinitely whilst using only IEEE-754 single precision floating point representations \cite{thesisGow}. This implementation could be compared to ours in more detail. It may be possible to apply the Quad tree approach to perform sub division of the path based coordinate systems to overcome some of the limitations of both approaches.
Arbitrary precision arithmetic is well understood, but from our review of the literature we have found little evidence of it's application to vector graphics. The well known graphics standards mention precision in passing, if at all. Ideally this work would motivate future document standards which can include detail at potentially arbitrary precision.
\begin{comment}
\begin{itemize}
\item What we have done?
\begin{itemize}
\item Implemented a basic SVG viewer
\item Demonstrated how precision affects rendering vector graphics
\item Showed how the choice of transformations to apply affects rendering
\item Using GMP rationals, demonstrated the ability to render SVGs scaled to an arbitrary position in a document
\end{itemize}
\item Possible future work
\begin{itemize}
\item Implement more of the SVG standard (eg: Shading)
\item Trial alternative number representations, eg: MPFR with algorithm to set precision
\item Allow for saving and loading SVGs with arbitrary precision
\item Deal with zooming very far in to intersection of lines (requires subdividing paths)
\item Compare with David's Quadtree
\end{itemize}
\end{itemize}
\end{comment}