MCPcopy Index your code
hub / github.com/clips/pattern / grid

Function grid

pattern/canvas.js:2528–2547  ·  view source on GitHub ↗
(cols, rows, colWidth, rowHeight, shuffled)

Source from the content-addressed store, hash-verified

2526}
2527
2528function 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

Callers

nothing calls this directly

Calls 2

rangeMethod · 0.80
pushMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…