Array.indices()

From ZCubes Wiki
Revision as of 10:39, 6 March 2017 by Joseph (talk | contribs)
Jump to navigation Jump to search

These functions operate on array locations and values to create contours and other interesting operations. Array Indices and XY Functions

Array.indices(Function,SubtractByArray,ScaleByArray,DoNotShowIndices,RowArray)

Returns the result of applying the Function/FunctionSet to each x,y location of the array, then subtracts and scales the results with SubtractByArray and ScaleByArray. DoNotShowIndices suppresses the x,y indices when outputting the result.

[1,2,3].indices(SIN).print()

[ [ [0,0 ] ],

[ [1,0.8414709848078965 ] ],

[ [2,0.9092974268256817 ] ] ]

MAGICSQUARE(3).indices()

0 0 0 0
0 1 0 1
0 2 0 2
1 0 1 0
1 1 1 1
1 2 1 2
2 0 2 0
2 1 2 1
2 2 2 2


MAGICSQUARE(3).indices(SUM,0,1,false)

0 0 0
0 1 1
0 2 2
1 0 1
1 1 2
1 2 3
2 0 2
2 1 3
2 2 4

0 1 2 1 2 3 2 3 4 MAGICSQUARE(3).indices(SUM,0,1,true)

0
1
2
1
2
3
2
3
4