10 Other classes

There are few end-user classes: mglGraph (see MathGL core), mglWindow and mglGLUT (see Widget classes), mglData (see Data processing), mglParse (see MGL scripts). Exactly these classes I recommend to use in most of user programs. All methods in all of these classes are inline and have exact C/Fortran analogue functions. This give compiler independent binary libraries for MathGL.

However, sometimes you may need to extend MathGL by writing yours own plotting functions or handling yours own data structures. In these cases you may need to use low-level API. This chapter describes it.

Class diagram for MathGL

The internal structure of MathGL is rather complicated. There are C++ classes mglBase, mglCanvas, ... for drawing primitives and positioning the plot (blue ones in the figure). There is a layer of C functions, which include interface for most important methods of these classes. Also most of plotting functions are implemented as C functions. After it, there are “inline” front-end classes which are created for user convenience (yellow ones in the figure). Also there are widgets for FLTK and Qt libraries (green ones in the figure).

Below I show how this internal classes can be used.