Difference between revisions of "× (LogiX node)"
Line 14: | Line 14: | ||
== Usage == <!--T:3--> | == Usage == <!--T:3--> | ||
− | When spawned from the node browser, this node accepts the float datatype by default. However, this node can be overloaded to accept different numeric value types if an appropriate wire is connected to an input. | + | When spawned from the node browser, this node accepts the float datatype by default. However, this node can be overloaded to accept different numeric value types if an appropriate wire is connected to an input. If vector datatypes are connected, e.g. float3 values, the multiplication is calculated element-wise. For example, if inputs A and B are [1,2,3] and [4,5,6] are connected the output will be [4,10,18]. |
This node can be overloaded to accept some mixtures of datatypes. For example if a vector value (e.g. a float3, RGBA color value etc.) is connected to the A input a scalar value (e.g. float) can be connected to the B input. The output will be a vector with the same number of dimensions as A with all elements multiplied by B. | This node can be overloaded to accept some mixtures of datatypes. For example if a vector value (e.g. a float3, RGBA color value etc.) is connected to the A input a scalar value (e.g. float) can be connected to the B input. The output will be a vector with the same number of dimensions as A with all elements multiplied by B. | ||
Another useful combination of datatypes allows strings to be repeated a defined number of times and concatenated together. To do this, connect the string to be repeated to input A and an integer (int) with the number of times the string should be repeated to input B. See below for an example. | Another useful combination of datatypes allows strings to be repeated a defined number of times and concatenated together. To do this, connect the string to be repeated to input A and an integer (int) with the number of times the string should be repeated to input B. See below for an example. | ||
+ | |||
+ | Note that, if the number of inputs is increased above 2, it is no longer possible to perform operations with mixed datatypes. | ||
== Examples == <!--T:4--> | == Examples == <!--T:4--> |
Revision as of 18:02, 14 November 2020
× | ||
---|---|---|
[[File:| |noframe|256px]] | ||
Inputs | ||
Float | A | |
Float | B | |
Outputs | ||
Float | * |
The × node multiplies the input values by each other and outputs the product.
Usage
When spawned from the node browser, this node accepts the float datatype by default. However, this node can be overloaded to accept different numeric value types if an appropriate wire is connected to an input. If vector datatypes are connected, e.g. float3 values, the multiplication is calculated element-wise. For example, if inputs A and B are [1,2,3] and [4,5,6] are connected the output will be [4,10,18].
This node can be overloaded to accept some mixtures of datatypes. For example if a vector value (e.g. a float3, RGBA color value etc.) is connected to the A input a scalar value (e.g. float) can be connected to the B input. The output will be a vector with the same number of dimensions as A with all elements multiplied by B.
Another useful combination of datatypes allows strings to be repeated a defined number of times and concatenated together. To do this, connect the string to be repeated to input A and an integer (int) with the number of times the string should be repeated to input B. See below for an example.
Note that, if the number of inputs is increased above 2, it is no longer possible to perform operations with mixed datatypes.
Examples
Given the inputs "A" and 3 would result in the output string "AAA"