3 new Array ICE nodes
Posted: 28 Feb 2014, 00:49
Get Grouped Sums Array
adds up groups of values from the input array and outputs the group sums as a new array. It can also do cumulative sums. If you're not working in a subcomponent context, you can also try this approach using GenerateSampleSet: http://xsisupport.com/2014/02/27/ice-su ... -of-group/
INPUTS
---> Input Array: The input array that gets read from for the additions (allows per subcomponent, object contexts and as datatype: vector, scalar, integer, quat, color)
---> Group Size(s): The number of elements in each "addition group". Can be an array.
---> Increment: Steps to take to find "next" group element to add. Usually 1 but other values can make sense, see examples.
OUTPUT
---> Result Array: Output array of the sums of the individual groups. Get set to the same datatype and context as the Input Array.
EXAMPLES
// Example 1: groups of 4
Input Array: [2,3,0,5,0,1,2,3,1,5,5,5]
Group Size: 4
Increment: 1
Result: [2+3+0+5, 0+1+2+3, 1+5+5+5]
// Example 2: groups of 3, every 4th element
Input Array: [2,3,0,5,0,1,2,3,1,5,5,5]
Group Size: 3
Increment: 4
Result: [2+0+1, 3+1+5, 0+2+5, 5+3+5]
// Example 3: differently sized groups
Input Array: [2,3,0,5,0,1,2,3,1,5,5,5]
Group Size: [1,5,2,4]
Increment: 1
Result: [2, 3+0+5+0+1, 2+3, 1+5+5+5]
// Example 4: cumulative sum
Input Array: [2,3,0,5,0,1,2,3,1,5,5,5]
Group Size: [1,2,3,4,5,6,7,8,9,10,11,12]
Increment: 0
Result: [2,5,5,10,10,11,13,16,17,22,27,32]
Get Grouped Products Array
Same for products of array entries... uses cross product for vectors
Get Cumulative Sums Array
This one is a convenience node that does what is shown in example #4. It contructs the group sizes array based on the input array and output the cumulative sums array [A1, A1+A2, A1+A2+A3, A1+A2+....]
Get Repetition Array
This is a simple compound that creates repetions of an array, number of repetions is configurable of course:
// Example #1:
Input Array: [2,3,0]
Nb Repetitions: 3
Repeat Full Array: True
Result: [2,3,0,2,3,0,2,3,0]
// Example #2:
Input Array: [2,3,0]
Nb Repetitions: 3
Repeat Full Array: False
Result: [2,2,2,3,3,3,0,0,0]
enjoy and please report any bugs/ideas!
-rr
adds up groups of values from the input array and outputs the group sums as a new array. It can also do cumulative sums. If you're not working in a subcomponent context, you can also try this approach using GenerateSampleSet: http://xsisupport.com/2014/02/27/ice-su ... -of-group/
INPUTS
---> Input Array: The input array that gets read from for the additions (allows per subcomponent, object contexts and as datatype: vector, scalar, integer, quat, color)
---> Group Size(s): The number of elements in each "addition group". Can be an array.
---> Increment: Steps to take to find "next" group element to add. Usually 1 but other values can make sense, see examples.
OUTPUT
---> Result Array: Output array of the sums of the individual groups. Get set to the same datatype and context as the Input Array.
EXAMPLES
// Example 1: groups of 4
Input Array: [2,3,0,5,0,1,2,3,1,5,5,5]
Group Size: 4
Increment: 1
Result: [2+3+0+5, 0+1+2+3, 1+5+5+5]
// Example 2: groups of 3, every 4th element
Input Array: [2,3,0,5,0,1,2,3,1,5,5,5]
Group Size: 3
Increment: 4
Result: [2+0+1, 3+1+5, 0+2+5, 5+3+5]
// Example 3: differently sized groups
Input Array: [2,3,0,5,0,1,2,3,1,5,5,5]
Group Size: [1,5,2,4]
Increment: 1
Result: [2, 3+0+5+0+1, 2+3, 1+5+5+5]
// Example 4: cumulative sum
Input Array: [2,3,0,5,0,1,2,3,1,5,5,5]
Group Size: [1,2,3,4,5,6,7,8,9,10,11,12]
Increment: 0
Result: [2,5,5,10,10,11,13,16,17,22,27,32]
Get Grouped Products Array
Same for products of array entries... uses cross product for vectors
Get Cumulative Sums Array
This one is a convenience node that does what is shown in example #4. It contructs the group sizes array based on the input array and output the cumulative sums array [A1, A1+A2, A1+A2+A3, A1+A2+....]
Get Repetition Array
This is a simple compound that creates repetions of an array, number of repetions is configurable of course:
// Example #1:
Input Array: [2,3,0]
Nb Repetitions: 3
Repeat Full Array: True
Result: [2,3,0,2,3,0,2,3,0]
// Example #2:
Input Array: [2,3,0]
Nb Repetitions: 3
Repeat Full Array: False
Result: [2,2,2,3,3,3,0,0,0]
enjoy and please report any bugs/ideas!
-rr