## objectList objectList — Gives storage for ids used by OpenGL lists and provides primitive routine for common drawing operations (distances, torus...). |

## Synopsis

    int                 visu_openGL_objectList_new          (int size);
    void                initObjectList                      (void);
    enum                VisuOpenGLArrowCentering;
    void                visu_openGL_drawSmoothArrow         (GLUquadricObj *obj,
                                                             int material_id,
                                                             VisuOpenGLArrowCentering centering,
                                                             float tailLength,
                                                             float tailRadius,
                                                             float tailN,
                                                             gboolean tailUseMat,
                                                             float hatLength,
                                                             float hatRadius,
                                                             float hatN,
                                                             gboolean hatUseMat);
    void                visu_openGL_drawEdgeArrow           (int material_id,
                                                             VisuOpenGLArrowCentering centering,
                                                             float tailLength,
                                                             float tailRadius,
                                                             gboolean tailUseMat,
                                                             float hatLength,
                                                             float hatRadius,
                                                             gboolean hatUseMat);
    void                visu_openGL_drawEllipsoid           (GLUquadricObj *obj,
                                                             int material_id,
                                                             float aAxis,
                                                             float bAxis,
                                                             float n,
                                                             gboolean useMat);
    void                visu_openGL_drawTorus               (GLUquadricObj *obj,
                                                             int material_id,
                                                             float radius,
                                                             float ratio,
                                                             int nA,
                                                             int nB,
                                                             gboolean useMat);
    void                visu_openGL_drawDistance            (float xyzRef[3],
                                                             float xyz[3],
                                                             gboolean drawLength);
    void                visu_openGL_drawAngle               (float xyzRef[3],
                                                             float xyzRef2[3],
                                                             float xyz[3],
                                                             guint id,
                                                             gboolean drawLength);

## Description

When using OpenGL list, one must specify ids. This module can return unused ids when needed.

Here are also defined the common primitive for drawing, see `visu_openGL_drawDistance()` for instance.

## Details

### visu_openGL_objectList_new ()

    int                 visu_openGL_objectList_new          (int size);

It returns the id that can be used to link glObjectList. This number is also added to the list of glObjectList to be displayed. The size parameter is the number of lists that could be used by the user for this glObjectList. Then the next call to this function will return the last value plus the size plus one.

`size` : | the requested size.
Returns : | an identifier used by OpenGl as a list.

### initObjectList ()

    void                initObjectList                      (void);

### enum VisuOpenGLArrowCentering

    typedef enum
      {
        VISU_OPENGL_ARROW_ORIGIN_CENTERED,
        VISU_OPENGL_ARROW_BOTTOM_CENTERED,
        VISU_OPENGL_ARROW_TAIL_CENTERED,
        VISU_OPENGL_ARROW_CENTERED
      } VisuOpenGLArrowCentering;

The way to draw arrows (see `visu_openGL_drawSmoothArrow()` for instance).

`VISU_OPENGL_ARROW_ORIGIN_CENTERED` | the arrows are positioned with respect to the point between tail and hat.
`VISU_OPENGL_ARROW_BOTTOM_CENTERED` | the arrows are positioned with respect to the bottom of the arrow ;
`VISU_OPENGL_ARROW_TAIL_CENTERED` | the arrows are positioned with respect to the center of the tail part ;
`VISU_OPENGL_ARROW_CENTERED` | the arrows are centered.

### visu_openGL_drawSmoothArrow ()

    void                visu_openGL_drawSmoothArrow         (GLUquadricObj *obj,
                                                             int material_id,
                                                             VisuOpenGLArrowCentering centering,
                                                             float tailLength,
                                                             float tailRadius,
                                                             float tailN,
                                                             gboolean tailUseMat,
                                                             float hatLength,
                                                             float hatRadius,
                                                             float hatN,
                                                             gboolean hatUseMat);

Draw arrows, using sqaure edges. For rounded arrows, see `visu_openGL_drawEdgeArrow()`.

`obj` : | ...
`material_id` : | an OpenGL list id for material change.
`centering` : | a flag.
`tailLength` : | length of tail part.
`tailRadius` : | length of edge of tail part.
`tailN` : | number of edges in the approximation.
`tailUseMat` : | use the material colour for the tail part.
`hatLength` : | length of hat part.
`hatRadius` : | length of edge of hat part.
`hatN` : | number of edges in the approximation.
`hatUseMat` : | use the material colour for the hat part.

Since 3.6

### visu_openGL_drawEdgeArrow ()

    void                visu_openGL_drawEdgeArrow           (int material_id,
                                                             VisuOpenGLArrowCentering centering,
                                                             float tailLength,
                                                             float tailRadius,
                                                             gboolean tailUseMat,
                                                             float hatLength,
                                                             float hatRadius,
                                                             gboolean hatUseMat);

Draw arrows, using sqaure edges. For rounded arrows, see `visu_openGL_drawSmoothArrow()`.

`material_id` : | an OpenGL list id for material change.
`centering` : | a flag.
`tailLength` : | length of tail part.
`tailRadius` : | length of edge of tail part.
`tailUseMat` : | use the material colour for the tail part.
`hatLength` : | length of hat part.
`hatRadius` : | length of edge of hat part.
`hatUseMat` : | use the material colour for the hat part.

Since 3.6

### visu_openGL_drawEllipsoid ()

    void                visu_openGL_drawEllipsoid           (GLUquadricObj *obj,
                                                             int material_id,
                                                             float aAxis,
                                                             float bAxis,
                                                             float n,
                                                             gboolean useMat);

Draw an ellipsoid.

`obj` : | ...
`material_id` : | an OpenGL list id for material change.
`aAxis` : | length of long axis.
`bAxis` : | length of short axis.
`n` : | number of edges for the sphere approximation.
`useMat` : | a flag to use the material definition or not.

Since 3.6

### visu_openGL_drawTorus ()

    void                visu_openGL_drawTorus               (GLUquadricObj *obj,
                                                             int material_id,
                                                             float radius,
                                                             float ratio,
                                                             int nA,
                                                             int nB,
                                                             gboolean useMat);

Draw a torus.

`obj` : | ...
`material_id` : | an OpenGL list id for material change.
`radius` : | global radius.
`ratio` : | ratio on internal radius over global radius.
`nA` : | number of edges for the global radius.
`nB` : | number of edges for the internal radius.
`useMat` : | a flag to use the material definition or not.

Since 3.5

### visu_openGL_drawDistance ()

    void                visu_openGL_drawDistance            (float xyzRef[3],
                                                             float xyz[3],
                                                             gboolean drawLength);

Draw a distance mark between `xyzRef` and `xyz`. A distance mark is a colour inverted line and two squared marks on node. `drawLength` is a flag to display or not the distance value.

`xyzRef` : | cartesian coordinates of first ref.
`xyz` : | cartesian coordinates of current point.
`drawLength` : | a boolean.

Since 3.6

### visu_openGL_drawAngle ()

    void                visu_openGL_drawAngle               (float xyzRef[3],
                                                             float xyzRef2[3],
                                                             float xyz[3],
                                                             guint id,
                                                             gboolean drawLength);

Draw an angle mark by to distance marks and a disk taking `xyzRef` as central point and `xyzRef2` and `xyz` as the two positions. `id` is a counter to obtain different colours for the disk and `drawLength` is a flag to display or not the angle value in degrees.

`xyzRef` : | cartesian coordinates of first ref.
`xyzRef2` : | cartesian coordinates of second ref.
`xyz` : | cartesian coordinates of current point.
`id` : | a counter.
`drawLength` : | a boolean.

Since 3.6