## cylinder

cylinder — Gives methods to draw cylinders as OpenGl objects pairing two elements.

## Synopsis

    #define     RESOURCES_CYLINDER_RADIUS_MIN
    #define     RESOURCES_CYLINDER_RADIUS_MAX
    PairsExtension* initPairsCylinder           ();

    int         setCylinderGeneralRadius        (float val);
    float       getCylinderGeneralRadius        ();
    int         setCylinderRadius               (PairsData *data,
                                                 float val);
    float       getCylinderRadius               (PairsData *data);
    int         setCylinderColorType            (int val);
    int         getCylinderColorType            ();

## Description

The cylinders have two characteristics : their radius and their colour. Their radius are in the units of the rendered box. They can be specific to each kind of pairs (e.g. Si-Si) or they have a default value. Only the default value is stored in the resource file with the flag "pairCylinder_radius". Their color is herited by the the colour of the pair. The lighting values (i.e. emi., shi., spe. ...) are not movable and are fixed to amb = 0.5, dif = 0.5, shi = 0, spe = 0, emi = 0.

## Details

### RESOURCES_CYLINDER_RADIUS_MIN

    #define RESOURCES_CYLINDER_RADIUS_MIN 0.01

Minimum value for the radius of cylinder pairs.

### RESOURCES_CYLINDER_RADIUS_MAX

    #define RESOURCES_CYLINDER_RADIUS_MAX 3.

Maximum value for the radius of cylinder pairs.

### initPairsCylinder ()

    PairsExtension* initPairsCylinder           ();

This method is used by V_Sim on startup, don't use it on your own.

Returns : | the cylinder pair extension.

### setCylinderGeneralRadius ()

    int         setCylinderGeneralRadius        (float val);

This method allows to change the default value of radius for cylinder pairs. When a pair is rendered via a cylinder, it first checks if that pairs has a specific radius value. If not, it uses the default value set by this method. If the default value is indeed changed, the pairs OpenGl list is not recreated automatically and the calling method should call the createPairs method according to the return value.

`val` : | a float value.
Returns : | 1 if the calling method should call the `createPairs()` method, 0 if not.

### getCylinderGeneralRadius ()

    float       getCylinderGeneralRadius        ();

Get the default value for cylinder radius.

Returns : | the default value for cylinder radius.

### setCylinderRadius ()

    int         setCylinderRadius               (PairsData *data,
                                                 float val);

This method allows to change the radius value of a specific pair. When a pair is rendered via a cylinder, it first checks if that pairs has a specific radius value set by this method. If not, it uses the default value. If the specific value is indeed changed, the pairs OpenGl list is not recreated automatically and the calling method should call the createPairs method according to the return value.

`data` : | a PairsData object ;
`val` : | a float value.
Returns : | 1 if the calling method should call the `createPairs()` method, 0 if not.

### getCylinderRadius ()

    float       getCylinderRadius               (PairsData *data);

Get the radius value for the specified pair.

`data` : | a PairsData object.
Returns : | the radius value.

### setCylinderColorType ()

    int         setCylinderColorType            (int val);

It set the color scheme for cylinder pairs. It can be 0 or 1.

`val` : | a integer that identify the color scheme.
Returns : | 1 if the calling method should call `createPairs()` and then emit the redrawing signal, 0 if not.

### getCylinderColorType ()

    int         getCylinderColorType            ();

Get the color scheme.

Returns : | an integer corresponding to the color scheme (0 or 1).