# Difference between revisions of "Conditional Boolean Scalar"

Line 1: | Line 1: | ||

− | |||

− | |||

− | |||

[[Image:drex_module_126_image_0.png|485pxpx|Conditional Boolean Scalar]] | [[Image:drex_module_126_image_0.png|485pxpx|Conditional Boolean Scalar]] | ||

Line 22: | Line 19: | ||

* It is an error for there to no '''Comparison value'''. In this case the '''Input''' value is output from the node. The '''Input''' value is not converted to a Boolean in this situation. | * It is an error for there to no '''Comparison value'''. In this case the '''Input''' value is output from the node. The '''Input''' value is not converted to a Boolean in this situation. | ||

− | |||

<!-- imported from file: module_126.html--> | <!-- imported from file: module_126.html--> | ||

+ | |||

+ | [[Category: Function Nodes]] | ||

+ | [[Category: Boolean]] |

## Revision as of 21:26, 17 May 2011

**Node Description & Purpose: **

This node is very similar to the Conditional scalar node. Please read the documentation for that node to understand the principles behind it and the general operation.

The main difference between the nodes is that this one is designed to work with Boolean values. A Boolean has a value of either 1 or 0. While you could use other nodes to convert values into Booleans and use them with the Conditional scalar node, this node is much more convenient when you want to work with Boolean values.

This node can be used with non-Boolean scalar inputs, but the input values will be converted to Booleans before the conditional operation is performed. If a non-Boolean value is input to the node then it is converted to 0 if the input value equals 0, and 1 if the input value is not equal to 0. As an example:**Input** of 0 **becomes** 0**Input** of 0.5 **becomes** 1**Input** of 2 **becomes** 1**Input** of -0.5 **becomes** 1

If you want more control over the conversion of scalar values to Boolean scalar values then you should use the Scalar to Boolean scalar node.

The other important difference with this node is that there are on If or Else input values. The node returns either 0 or 1 depending on the comparison operation.**Node Type: **Function**Settings: **

**Condition:**This popup lets you choose the condition, or type of comparison, the node uses. A list of the comparisons follows, along with a short description:

__Greater than__: If the**Input**value is*greater than*the comparison value then 1 will be output, otherwise the output value will be 0.__Greater than or equal to__: If the**Input**value is*greater than or equal to*the comparison value then 1 will be output, otherwise the output value will be 0.__Equal to__: If the**Input**value is*equal to*the comparison value then 1 will be output, otherwise the output value will be 0.__Not equal to__: If the**Input**value is*not equal to*the comparison value then 1 will be output, otherwise the output value will be 0.__Less than__: If the**Input**value is*less than*the comparison value then 1 will be output, otherwise the output value will be 0.__Less than or equal to__: If the**Input**value is*less than or equal to*the comparison value then 1 will be output, otherwise the output value will be 0.__Boolean AND__: If the**Input**value*and*the comparison value are 1 then 1 will be output, otherwise the output value will be 0.__Boolean OR__: If the**Input**value*or*the comparison value are 1 then 1 will be output, otherwise the output value will be 0.

**Comparison value:**This is the value which the**Input**value is compared with.

**Error conditions:**

- It is an error for there to be no
**Input**value. In that case 0 is output from the node. - It is an error for there to no
**Comparison value**. In this case the**Input**value is output from the node. The**Input**value is not converted to a Boolean in this situation.

A scalar is a single number. 1, 200.45, -45, -0.2 are all examples of scalar values.

A single object or device in the node network which generates or modifies data and may accept input data or create output data or both, depending on its function. Nodes usually have their own settings which control the data they create or how they modify data passing through them. Nodes are connected together in a network to perform work in a network-based user interface. In Terragen 2 nodes are connected together to describe a scene.