# Difference between revisions of "Conditional Boolean Scalar"

(jrfconvert import) |
|||

Line 3: | Line 3: | ||

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

+ | |||

+ | '''Node Description & Purpose: '''<br /> 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.<br /><br /> 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.<br /><br /> 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:<br /><br />'''Input''' of 0 '''becomes''' 0<br />'''Input''' of 0.5 '''becomes''' 1<br />'''Input''' of 2 '''becomes''' 1<br />'''Input''' of -0.5 '''becomes''' 1<br /><br /> 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. <br /><br /> 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.<br /><br />'''Node Type: '''Function<br /><br />'''Settings: '''<br /> | ||

+ | |||

+ | * '''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:<br /> | ||

+ | ** <u>Greater than</u><nowiki>: If the </nowiki>'''Input''' value is ''greater than'' the comparison value then 1 will be output, otherwise the output value will be 0. | ||

+ | ** <u>Greater than or equal to</u><nowiki>: If the </nowiki>'''Input''' value is ''greater than or equal to'' the comparison value then 1 will be output, otherwise the output value will be 0. | ||

+ | ** <u>Equal to</u><nowiki>: If the </nowiki>'''Input''' value is ''equal to'' the comparison value then 1 will be output, otherwise the output value will be 0. | ||

+ | ** <u>Not equal to</u><nowiki>: If the </nowiki>'''Input''' value is ''not equal to'' the comparison value then 1 will be output, otherwise the output value will be 0. | ||

+ | ** <u>Less than</u><nowiki>: If the </nowiki>'''Input''' value is ''less than'' the comparison value then 1 will be output, otherwise the output value will be 0. | ||

+ | ** <u>Less than or equal to</u><nowiki>: If the </nowiki>'''Input''' value is ''less than or equal to'' the comparison value then 1 will be output, otherwise the output value will be 0. | ||

+ | ** <u>Boolean AND</u><nowiki>: If the </nowiki>'''Input''' value ''and'' the comparison value are 1 then 1 will be output, otherwise the output value will be 0. | ||

+ | ** <u>Boolean OR</u><nowiki>: If the </nowiki>'''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. | ||

+ | |||

+ | <br />'''Error conditions:'''<br /> | ||

+ | |||

+ | * 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. | ||

+ | |||

__NOTOC__ | __NOTOC__ | ||

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

## Revision as of 21:12, 28 April 2011

**Conditional Boolean Scalar**[edit]

**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.