## visu_nodes

visu_nodes — Defines the elementary structure to store informations about an element in a box.

## Synopsis

    struct      node_struct;
    typedef     VisuNode;
    void        visuNodeSet_newValues           (VisuNode *node,
                                                 double x,
                                                 double y,
                                                 double z,
                                                 int number,
                                                 int rendered,
                                                 int posEle,
                                                 int posNod);
    gboolean    visuNodeGet_visibility          (VisuNode *node);
    int         visuNodeSet_visibility          (VisuNode *node,
                                                 gboolean visibility);

## Description

In V_Sim, elements are drawn in a box. The VisuNode structure is used to represent an instance of an element position somewhere in the box. This element can have several characteristics such as its translation or its visibility.

All nodes are stored in a VisuData object in a two dimensional array. The first dimension is indexed by the VisuElement of the node and the second corresponds to the number of this node for this element. When a node is own by a VisuData, the two integers, that control the indexes in this array, are not negative. See the VisuNode structure for further explanations.

The only basic informations own by the VisuNode structure is basicaly its position. To add further informations (such as orientation for the spin), the node must be attached to a VisuData and then `visuDataAdd_nodeProperty()` can be used.

## Details

### struct node_struct

    struct node_struct {
      /* coordinates of the node. */
      double x, y, z;

      /* translation */
      float translation[3];

      /* Number of this element in the input file. */
      int number;
      /* Position in the #VisuData structure. */
      int posElement, posNode;

      /* A boolean to specify if if this node is rendered or not. */
      int rendered;
    };

Structure to store primary data of a node.

double `x`; | a floating point value that positions the node on x axis ;
double `y`; | a floating point value that positions the node on y axis ;
double `z`; | a floating point value that positions the node on z axis ;
float `translation`[3]; | an array of three floating point values that translates the node to its drawn position from (x, y, z) ;
int `number`; | an integer that corresponds to its position in the entry file, it references also the node itself in the array 'fromNumberToVisuNode' of the VisuData that contains the node ;
int `posElement`; | an integer that is the position of the VisuElement of the node in the array 'fromIntToVisuElement' of the VisuData object that contains the node ;
int `posNode`; | an integer that is the position of the node itself in the array 'nodes' of the VisuData object that contains the node ;
int `rendered`; | a boolean to store if the node is drwn or not.

### VisuNode

    typedef struct node_struct VisuNode;

Short way to address node_struct objects.

### visuNodeSet_newValues ()

    void        visuNodeSet_newValues           (VisuNode *node,
                                                 double x,
                                                 double y,
                                                 double z,
                                                 int number,
                                                 int rendered,
                                                 int posEle,
                                                 int posNod);

This method doesn't allocate the node it works on. It should be already allocated. Moreover it should not have been already initialised since nothing from the node is freed before giving the values.

`node` : | an allocated VisuNode object ;
`x` : | its x coordinate ;
`y` : | its y coordinate ;
`z` : | its z coordinate ;
`number` : | its position in the input file (or anything else that can uniqualy identify this new VisuNode) ;
`rendered` : | 1 if draw, 0 otherwise ;
`posEle` : | an int corresponding the number of the VisuElement it is associated with ;
`posNod` : | an int corresponding to the position of the node in the node table of the VisuData in which it is allocated ;

### visuNodeGet_visibility ()

    gboolean    visuNodeGet_visibility          (VisuNode *node);

This method is used get the status of the drawing state of a node.

`node` : | a VisuNode object.
Returns : | true if the node is rendered, false otherwise.

### visuNodeSet_visibility ()

    int         visuNodeSet_visibility          (VisuNode *node,
                                                 gboolean visibility);

This method is used to turn on or off the drawing of the specified node.

`node` : | a VisuNode object ;
`visibility` : | a boolean.
Returns : | true if the calling method should recreate the node list with a call to the `visuData_createAllNodes()` method.

## See Also

See also VisuElement and VisuData.