| 2526 | } |
| 2527 | |
| 2528 | function grid(cols, rows, colWidth, rowHeight, shuffled) { |
| 2529 | /* Returns an array of Points for the given number of rows and columns. |
| 2530 | * The space between each point is determined by colwidth and colheight. |
| 2531 | */ |
| 2532 | if (colWidth === undefined) colWidth = 1; |
| 2533 | if (rowHeight === undefined) rowHeight = 1; |
| 2534 | rows = Array.range(parseInt(rows)); |
| 2535 | cols = Array.range(parseInt(cols)); |
| 2536 | if (shuffled) { |
| 2537 | Array.shuffle(rows); |
| 2538 | Array.shuffle(cols); |
| 2539 | } |
| 2540 | var a = []; |
| 2541 | for (var y in rows) { |
| 2542 | for (var x in cols) { |
| 2543 | a.push(new Point(x*colWidth, y*rowHeight)); |
| 2544 | } |
| 2545 | } |
| 2546 | return a; |
| 2547 | } |
| 2548 | |
| 2549 | /*##################################################################################################*/ |
| 2550 | |