# multigrid.pf # aym3ric-at-goto10-dot-org # a 2 dimensions grid list generator, useful to generate a list of # coordinates for a whole section of the display # # ATM, multigrid takes as input 3 numbers # - the length (X) # - the height (Y) # - the number of elements to generate for each side # # example: # to create a 1 by 1 grid made of 16 nodes # # 1 1 4 multigrid # # TODO: make a n-dimensions version # "interpol.pf" load : multigrid dup >r 3 pack dup unpack # we compute the top horizontal block >r >float 2. / >r >float 2. / -1. * r> swap 2 pack dup unpack abs 2 pack r> 1 - 3 pack reverse 1 pack interpol # we compute the interval >r unpack dup >r >float >r >float r> 1. - / nip 0. 2 pack dup r> 1 - 3 pack reverse 1 pack interpol r> # we compute all the horizontal blocks swap >r dup >r >list r> r> r> 1 - dup >r for dup >r - dup >list swap r> next drop drop r> for concat next ;