4.3. Scalar (element)

<scalar> ‐ An element for the definition of scalar variables

4.3.1. Attributes

NameTypeDefaults
idSTRINGNone (required)
typeSTRINGfloat
valueINTEGER0
valueFLOAT0.0
valueSTRINGEmpty string
xlink:hrefURIEmpty string

4.3.2. Description

The <scalar> element is used to define a scalar value attached to a node in a scene graph. The scalar element must be located inside a node.

The string value of the type attribute is equal to int in the case of an integer scalar, It is equal to float in the case of a float scalar, and equal to string in the case of a string scalar.

The initial value of the scalar is defined by the value of the value attribute. This value must have the type of the scalar as defined by the type attribute.

If the tag has xlink:href attribute, the initial value of the scalar is copied from a file. The external file reference, given by the the URI reference (Uniform Resource Identifier), contains the initial value.

4.3.3. Expected children

None.

4.3.4. Example

The following example, defines the scalar named initialSite. Its first value is a random integer between 1 and {#nbBirds}:

<node id="birdPath_{#n}">
  <scalar id="initialSite" type="int" 
          value="(rand(1,({#nbBirds}+0.9999)))" />
  <transformation id="transformation_birdPath_{#n}" 
                  geometry="path-transformation" size="1" with_roll="true">