A game about forced loneliness, made by TACStudios
1# Matrix Split Node
2
3## Description
4
5Splits a square matrix defined by input **In** into vectors. Output vector dimension is defined by the dimension of the input matrix.
6
7The dropdown on the node can be used to select whether the output values are taken from the rows or columns of the input matrix.
8
9* **Row** : Output vectors are composed of matrix rows from top to bottom.
10* **Column** : Output vectors are composed of matrix columns from left to right.
11
12An input matrix of type **Matrix 2x2** or **Matrix 3x3** will return 0 values in the rows (or columns, depending on dropdown selection) that are beyond their dimension.
13
14For example, connecting **Matrix 2x2** type to input **In** will return the correct **Vector 2** type outputs to output slots **M0** and **M1**, leaving outputs **M2** and **M3** to return 0 values.
15
16## Ports
17
18| Name | Direction | Type | Description |
19|:------------ |:-------------|:-----|:---|
20| In | Input | Dynamic Matrix | Input value |
21| M0 | Output | Dynamic Vector | First row or column |
22| M1 | Output | Dynamic Vector | Second row or column |
23| M2 | Output | Dynamic Vector | Third row or column |
24| M3 | Output | Dynamic Vector | Fourth row or column |
25
26## Controls
27
28| Name | Type | Options | Description |
29|:------------ |:-------------|:-----|:---|
30| | Dropdown | Row, Column | Selects how the output vectors should be filled |
31
32## Generated Code Example
33
34The following example code represents one possible outcome of this node.
35
36```
37float2 _MatrixSplit_M0 = float2(In[0].r, In[0].g);
38float2 _MatrixSplit_M1 = float2(In[1].r, In[1].g);
39float2 _MatrixSplit_M2 = float2(0, 0);
40float2 _MatrixSplit_M3 = float2(0, 0);
41```