Distance Node
Access: Nodes > Math > Distance
The Distance node outputs the distance between two input vectors using the calculation:
The Distance node can be especially useful when calculating the distance between 2D or 3D positions. The output is a single value copied across each component for the vector output, except for the alpha component, which retains its original input value.
Distance Node Example
Input | Calculation | Output |
InputA = 0.0, 0.0, 0.0, 0.0 InputB = 1.0, 0.0, 0.0, 0.0 |
d = √((1.0 - 0.0)^{2} + (0.0 - 0.0)^{2} + (0.0 - 0.0)^{2} + (0.0 - 0.0)^{2}) d = 1.0 |
1.0, 1.0, 1.0, 1.0 |
InputA = 0.0, 0.0, 0.0, 0.0 InputB = 0.0, 3.0, 4.0, 1.0 |
d = √((0.0 - 0.0)^{2} + (3.0 - 0.0)^{2} + (4.0 - 0.0)^{2} + (0.0 - 0.0)^{2}) d = 5.0 |
5.0, 5.0, 5.0, 1.0 |
Note: Alpha components retain their original value even if they are included in the calculation.
Tip: To learn more about the distance equation solution, see the 3D Distance Calculator on calculatorsoup.
Distance Node Inputs
InputA |
The first vector from which the distance is calculated. |
InputB |
The second vector to which the distance is calculated. |
Distance Node Properties
R checkbox |
When checked, includes the red component in the distance calculation. |
G checkbox |
When checked, includes the green component in the distance calculation. |
B checkbox |
When checked, includes the blue component in the distance calculation. |
A checkbox |
When checked, includes the alpha component in the distance calculations. However, the alpha component is passed through to the output as its original value. For example, an input alpha value of 1.0 is output as an alpha value of 1.0. |