import { map } from "./map.js" ; example param n param includeLast export function * normRange ( n , includeLast = true ) { if ( n > 0 ) { for ( let i = 0 , m = includeLast ? n + 1 : n ; i < m ; i ++ ) { yield i / n ; } } } /**
 * 2D version of  normRange in Y-major order (i.e. X is inner loop).
 *
 *  param nx param ny param includeLastX param includeLastY export function * normRange2d ( nx , ny , includeLastX = true , includeLastY = true ) { const rx = [ ... normRange ( nx , includeLastX ) ] ; for ( let y of normRange ( ny , includeLastY ) ) { yield * map ( ( x ) => [ x , y ] , rx ) ; } } /**
 * 3D version of  normRange in Z-major order (i.e. X being innermost
 * loop).
 *
 *  param nx param ny param includeLastX param includeLastY export function * normRange3d ( nx , ny , nz , includeLastX = true , includeLastY = true , includeLastZ = true ) { const sliceXY = [ ... normRange2d ( nx , ny , includeLastX , includeLastY ) ] ; for ( let z of normRange ( nz , includeLastZ ) ) { yield * map ( ( xy ) => [ ... xy , z ] , sliceXY ) ; } }