next up previous contents
Next: Bison/Flex - Adding a Up: The Bloch Sphere Previous: The Bloch Sphere   Contents

libplot

To draw the bloch sphere, the GNU libplot library is used. Libplot is a freely available C/C++ function library for device-independent 2-D vector graphics. The C++ class library is called libplotter, which provides an object-oriented interface to libplot's functionality, is used in this project. To use libplot, a pointer to a Plotter object is created with the command;


\begin{lstlisting}[frame=trbl]{}
Plotter *plot;
\end{lstlisting}


The page size and picture size are set by the following commands;
\begin{lstlisting}[frame=trbl]{}
Plotter::parampl(''PAGESIZE'', (void*)optPlotPa...
...str());
Plotter::parampl(''BITMAPSIZE'', (void*)''400x400'');
\end{lstlisting}


The line size and colour can be set with the following commands;
\begin{lstlisting}[frame=trbl]{}
plot->flinewidth (0.25);
plot->pencolorname(const char *name);
\end{lstlisting}


The Plotter object can draw strings on the screen with the following command;
\begin{lstlisting}[frame=trbl]{}
plot->fmove (double x, double y);
plot->alabel(int horiz_justify, int vert_justify, const char *s);
\end{lstlisting}


The circle for the Bloch Sphere can be drawn with the command;
\begin{lstlisting}[frame=trbl]{}
plot->circle(int xc, int yc, int r);
\end{lstlisting}


The axes can be drawn with the command;
\begin{lstlisting}[frame=trbl]{}
plot->line(int x1, int y1, int x2, int y2);
\end{lstlisting}


The semi-circle ellipse at the center of the sphere can be drawn with the command;
\begin{lstlisting}[frame=trbl]{}
plot->ellipse (int xc, int yc, int rx, int ry, int angle);
\end{lstlisting}


The filled circle which represents the position of the qubit on the bloch sphere, can be drawn with the command;
\begin{lstlisting}[frame=trbl]{}
plot->fmarker(double x, double y, int type, double size);
\end{lstlisting}



next up previous contents
Next: Bison/Flex - Adding a Up: The Bloch Sphere Previous: The Bloch Sphere   Contents
Colm O hEigeartaigh 2003-05-30