wire

wire — Gives methods to draw lines as OpenGl objects pairing two elements.

Synopsis




PairsExtension* initPairsWire               ();
int         setWireGeneralWidth             (int val);
int         getWireGeneralWidth             ();
int         setWireWidth                    (PairsData *data,
                                             int val);
int         getWireWidth                    (PairsData *data);
int         setWireNonLinear                (int val);
int         getWireNonLinear                ();
float*      getLengthSampleForColor         (int color,
                                             int *size);

Description

The wire pair module is the simplest way to draw pairs between elements : using lines. The size of lines can be chosen but is limited by OpenGL implementation that usually only allow line width of 10 pixels as maximum size.

Details

initPairsWire ()

PairsExtension* initPairsWire               ();

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

Returns : the wire pair extension.

setWireGeneralWidth ()

int         setWireGeneralWidth             (int val);

The width of line between elements can be chosen by kinds of pairs, but can use a default value for all kinds of pairs when no individual value is available. Use this method to set the default width.

val : a positive integer.
Returns : 1 if the calling method should call the createPairs() method, 0 if not.

getWireGeneralWidth ()

int         getWireGeneralWidth             ();

Get the default width for wire pairs (see setWireGeneralWidth() to set this value).

Returns : the default width.

setWireWidth ()

int         setWireWidth                    (PairsData *data,
                                             int val);

This method allows to change the width of line for a specific pair. When a pair is rendered via with a line, it first checks if that pairs has a specific width 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 positive integer.
Returns : 1 if the calling method should call the createPairs() method, 0 if not.

getWireWidth ()

int         getWireWidth                    (PairsData *data);

Get the width of the given pair data. If the given pair has no specific width, the defaul value is returned.

data : a PairsData object.
Returns : the width of the given pair.

setWireNonLinear ()

int         setWireNonLinear                (int val);

If the val argument is true, the wire drawn as pairs do not use their user-defined color but instead are colored using a function depending on the length. See getLengthSampleForColor() to know how to change this colorization function.

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

getWireNonLinear ()

int         getWireNonLinear                ();

Get if color are user-defined or length dependent.

Returns : 1 if color is length dependent.

getLengthSampleForColor ()

float*      getLengthSampleForColor         (int color,
                                             int *size);

When pairs colors are length dependent, an array is used to store the colorization function. This function is a two variables one, the first variable is the color channel and the second gives the correspondance between [0;1] (length variabtion between pair_min and pair_max) and [0;1] (color variation in the given channel). The color channels must be RGB coded. This method is used to get one of the array for the given channel (color). The calling method should sample the transformation function and store it in the returned array. Its size is stored in the size argument.

color : an integer [0;2], coding for RGB channel ;
size : a pointer to an integer.
Returns : the star of the transformation array for the given color channel.