\documentclass{article}
\usepackage{axiom}
\begin{document}
\title{\$SPAD/src/graph fileformats }
\author{The Axiom Team}
\maketitle
\begin{abstract}
\end{abstract}
\eject
\tableofcontents
\eject
\section{The viewFile data file format}
The viewFile is a control file for graph information. It contains
settings for particular graphs. There are some general window
settings that apply to the whole graph window followed by 9
graph settings, one for each possible graph shown.
\subsection{The viewType}
The viewType (A) is a switch used to decide what tool will be used to
display the graph. At present there are 4 values defined (in the
file [[src/graph/include/action.h]]) which are:
\begin{verbatim}
/* Viewport Types */
#define view3DType     1
#define viewGraphType  2
#define view2DType     3
#define viewTubeType   4
\end{verbatim}
In the example below the integer value is '3', at (A), 
therefore it is of 'view2DType' meaning a 2D graph.

This value is read in [[src/graph/viewAlone/viewAlone.c]]
\subsection{The title}
The title, at (B), is read in [[src/graph/viewAlone/spoon2D.c]].
It can be a maximum of 256 characters.
\subsection{The window boundaries}
There are 4 integers, at (C), the X, Y, Width, and Height
which represent the window size in pixels.
\subsection{The graph specifications}
There are, at (D), a series of specifications for the 9
possible graphs. They are all in groups of 6 lines, one
per graph. These lines are stored in a data structure called
the [[graphArray]] or the [[graphStateArray]]. The lines are:
\begin{list}{}
\item D1 is either an integer value 0 or 1 (\%d format). 
If the value is zero the rest of the information is ignored and 
the graph is not displayed. If the value is 1 then the graph is 
displayed. This information is stored in [[graphArray[i].key]].
\item D2 are 2 C general numbers (\%g format). They represent
the scale factors in X and Y. This information is stored in
[[graphStateArray[i].scaleX]] and [[graphStateArray[i].scaleY]].
\item D3 are 2 C general numbers (\%g format). They represent 
the change in X and Y increments. This information is stored in
[[graphStateArray[i].deltaX]] and [[graphStateArray[i].deltaY]].
\item D4 are 2 C general numbers (\%g format). They represent the
center for the X and Y axes. This information is stored in
[[graphStateArray[i].centerX]] and [[graphStateArray[i].centerY]].
\item D5 are 7 integers (\%d format). They represent:
\begin{list}{}
\item pointsOn - 0 means no points, 1 means plot points.
Stored in [[graphStateArray[i].pointsOn]].
\item connectOn - 0 means isolated points, 1 means connected points.
Stored in [[graphStateArray[i].connectOn]].
\item splineOn - 0 means no spline, 1 means spline.
Stored in [[graphStateArray[i].splineOn]].
\item axesOn - 0 means no axes, 1 means draw axes.
Stored in [[graphStateArray[i].axesOn]].
\item axesColor - 0 means black and white, 1 means color.
Stored in [[graphStateArray[i].axesColor]].
\item unitsOn - 0 means no tick marks (units), 1 means units.
Stored in [[graphStateArray[i].unitsOn]].
\item unitsColor - 0 means black and white, 1 means color.
Stored in [[graphStateArray[i].unitsColor]].
\end{list}
\item D6 are 2 C integers (\%d format). 
\begin{list}{}
\item showing - 0 means the graph is hidden, 1 means showing.
Stored in [[graphStateArray[i].showing]].
\item selected - 0 means not selected, 1 means selected.
Stored in [[graphStateArray[i].selected]].
\end{list}
\end{list}
\begin{verbatim}
3                                          (A)
x*x                                        (B)
0 0 400 400                                (C)
1                                          (D1) (graph0)
0.867014 0.575432                          (D2)
0 0                                        (D3)
0 0                                        (D4)
1 1 1 1 61 1 68                            (D5)
1 1                                        (D6)
0                                               (graph1)
0.9 0.9
0 0
0 0
1 1 0 1 0 0 0
0 0
0                                               (graph2)
0.9 0.9
0 0
0 0
1 1 0 1 0 0 0
0 0
0                                               (graph3)
0.9 0.9
0 0
0 0
1 1 0 1 0 0 0
0 0
0                                               (graph4)
0.9 0.9
0 0
0 0
1 1 0 1 0 0 0
0 0
0                                               (graph5)
0.9 0.9
0 0
0 0
1 1 0 1 0 0 0
0 0
0                                               (graph6)
0.9 0.9
0 0
0 0
1 1 0 1 0 0 0
0 0
0                                               (graph7)
0.9 0.9
0 0
0 0
1 1 0 1 0 0 0
0 0
0                                               (graph8)
0.9 0.9
0 0
0 0
1 1 0 1 0 0 0
0 0
\end{verbatim}
\section{The graph file format}
There are up to 9 files, named [ [[graph0]] .. [[graph8]] ].
There is one file per graph as indicated by the [[data]] file above.
\subsection{The bounding values}
There are 4 integers (\%d format) at (A) giving the xmin, ymin, xmax, and
ymax values for the graph. These are stored in
[[graphArray[i].xmin]], [[graphArray[i].ymin]], [[graphArray[i].xmax]],
and [[graphArray[i].ymax]].

There are 2 general numbers (\%g format) at (B)
giving the xNorm and yNorm values. These are stored in
[[graphArray[i].xNorm]] and [[graphArray[i].yNorm]].

There are 2 general numbers (\%g format) at (C) 
giving the X origin and Y origin values. These are stored in
[[graphArray[i].originX]] and [[graphArray[i].originY]].

There are 2 general numbers (\%g format) at (D)
giving the X units and Y units from Axiom. These are stored in
[[graphArray[i].spadUnitX]] and [[graphArray[i].spadUnitY]].

There are 2 general numbers (\%g format) at (E)
giving the X units and Y units in graph coordinates. These are stored in
[[graphArray[i].unitX]] and [[graphArray[i].unitY]].

There is 1 integer (\%d format) at (F)
giving the number of lists that make up the graph. This is stored in
[[graphArray[i].numberOfLists]]. 

For each list, and in this case there is only 1 list. Each list
is stored in a [[pointListStruct]] pointed to by [[aList]].
In this case we have:
\begin{list}{}
\item (G) is the number of points in the list. This is 1 integer
(\%d format). It is stored in [[aList->numberOfPoints]].
\item (H) is 3 integers (\%d format) which represent the point color,
the line color, and the point size. These are stored in
[[aList->pointColor]], [[aList->lineColor]], and [[aList->pointSize]].
\item (I) is 4 general numbers (\%g format) which represent the
x, y, hue, and shade of a point. These are stored in a structure
called [[aPoint]] which consists of
[[aPoint->x]],[[aPoint->y]],[[aPoint->hue]], and [[aPoint->shade]].
These are pointed to by the [[aList]] structure. There are as many
copies of this data as there are points in the graph (G)
\end{list}

\begin{verbatim}
-3 0 3 9                           (A)  
0.166667 0.111111                  (B)
1.49012e-08 -0.5                   (C)
1.2 1.8                            (D)
0.2 0.2                            (E)
1                                  (F)
49                                 (G)
91 135 3                           (H)
-0.5 0.5 0 2                       (I) repeated (G) times
-0.479167 0.418403 0 2
-0.458333 0.340278 0 2
-0.4375 0.265625 0 2
-0.416667 0.194444 0 2
-0.395833 0.126736 0 2
-0.375 0.0625 0 2
-0.354167 0.00173611 0 2
-0.333333 -0.0555556 0 2
-0.3125 -0.109375 0 2
-0.291667 -0.159722 0 2
-0.270833 -0.206597 0 2
-0.25 -0.25 0 2
-0.229167 -0.289931 0 2
-0.208333 -0.326389 0 2
-0.1875 -0.359375 0 2
-0.166667 -0.388889 0 2
-0.145833 -0.414931 0 2
-0.125 -0.4375 0 2
-0.104167 -0.456597 0 2
-0.0833333 -0.472222 0 2
-0.0625 -0.484375 0 2
-0.0416667 -0.493056 0 2
-0.0208333 -0.498264 0 2
1.49012e-08 -0.5 0 2
0.0208333 -0.498264 0 2
0.0416667 -0.493056 0 2
0.0625 -0.484375 0 2
0.0833334 -0.472222 0 2
0.104167 -0.456597 0 2
0.125 -0.4375 0 2
0.145833 -0.414931 0 2
0.166667 -0.388889 0 2
0.1875 -0.359375 0 2
0.208333 -0.326389 0 2
0.229167 -0.289931 0 2
0.25 -0.25 0 2
0.270833 -0.206597 0 2
0.291667 -0.159722 0 2
0.3125 -0.109375 0 2
0.333333 -0.0555556 0 2
0.354167 0.00173611 0 2
0.375 0.0625 0 2
0.395833 0.126736 0 2
0.416667 0.194444 0 2
0.4375 0.265625 0 2
0.458333 0.340278 0 2
0.479167 0.418403 0 2
0.5 0.5 0 2
\end{verbatim}
\section{The parabola}
<<data>>=
3
x*x
0 0 400 400
1
0.867014 0.575432
0 0
0 0
1 1 1 1 61 1 68
1 1
0
0.9 0.9
0 0
0 0
1 1 0 1 0 0 0
0 0
0
0.9 0.9
0 0
0 0
1 1 0 1 0 0 0
0 0
0
0.9 0.9
0 0
0 0
1 1 0 1 0 0 0
0 0
0
0.9 0.9
0 0
0 0
1 1 0 1 0 0 0
0 0
0
0.9 0.9
0 0
0 0
1 1 0 1 0 0 0
0 0
0
0.9 0.9
0 0
0 0
1 1 0 1 0 0 0
0 0
0
0.9 0.9
0 0
0 0
1 1 0 1 0 0 0
0 0
0
0.9 0.9
0 0
0 0
1 1 0 1 0 0 0
0 0
@
<<graph0>>=
-3 0 3 9
0.166667 0.111111
1.49012e-08 -0.5
1.2 1.8
0.2 0.2
1
49
91 135 3
-0.5 0.5 0 2
-0.479167 0.418403 0 2
-0.458333 0.340278 0 2
-0.4375 0.265625 0 2
-0.416667 0.194444 0 2
-0.395833 0.126736 0 2
-0.375 0.0625 0 2
-0.354167 0.00173611 0 2
-0.333333 -0.0555556 0 2
-0.3125 -0.109375 0 2
-0.291667 -0.159722 0 2
-0.270833 -0.206597 0 2
-0.25 -0.25 0 2
-0.229167 -0.289931 0 2
-0.208333 -0.326389 0 2
-0.1875 -0.359375 0 2
-0.166667 -0.388889 0 2
-0.145833 -0.414931 0 2
-0.125 -0.4375 0 2
-0.104167 -0.456597 0 2
-0.0833333 -0.472222 0 2
-0.0625 -0.484375 0 2
-0.0416667 -0.493056 0 2
-0.0208333 -0.498264 0 2
1.49012e-08 -0.5 0 2
0.0208333 -0.498264 0 2
0.0416667 -0.493056 0 2
0.0625 -0.484375 0 2
0.0833334 -0.472222 0 2
0.104167 -0.456597 0 2
0.125 -0.4375 0 2
0.145833 -0.414931 0 2
0.166667 -0.388889 0 2
0.1875 -0.359375 0 2
0.208333 -0.326389 0 2
0.229167 -0.289931 0 2
0.25 -0.25 0 2
0.270833 -0.206597 0 2
0.291667 -0.159722 0 2
0.3125 -0.109375 0 2
0.333333 -0.0555556 0 2
0.354167 0.00173611 0 2
0.375 0.0625 0 2
0.395833 0.126736 0 2
0.416667 0.194444 0 2
0.4375 0.265625 0 2
0.458333 0.340278 0 2
0.479167 0.418403 0 2
0.5 0.5 0 2
@
<<*>>=
@
\eject
\begin{thebibliography}{99}
\bibitem{1} nothing
\end{thebibliography}
\end{document}