or(q1, q2, row, col)
Returns a new quadrille containing all the filled cells from the q1 quadrille or q2 quadrille, or both, with q1 cells taking precedence.
Example
(to move q2 drag mouse or press a, s, w, z keys)
Note
Observe that the dimensions of the resulting
q3quadrille span the minimum area required to cover bothq1andq2. See merge.
Note
This demo omits
row/colon purpose. When they're omitted, the offset is inferred from where each operand was last drawn — the same per-draw capture behind mouseRow/mouseCol:row = row2 − row1,col = col2 − col1from the operands' lastdrawQuadrillecell positions (both operands drawn, at cell-aligned positions; otherwise the offset falls back to0). That's why draggingq2moves the overlap: each draw refreshes its captured position, and the algebra follows.
Syntax
Quadrille.or(q1, q2, [row], [col])
Parameters
| Param | Description |
|---|---|
q1 |
Quadrille: first quadrille to merge |
q2 |
Quadrille: second quadrille to merge |
row |
Number: The vertical displacement of q2 relative to q11. Negative values are allowed |
col |
Number: The horizontal displacement of q2 relative to q12. Negative values are allowed |
What this page's examples use
- p5.quadrille
drawQuadrillecreateQuadrillecellLengthmouseRowmouseColor- p5.js
createCanvascolortextkey
Names the analysis can prove are called, and the line each one is documented on. Local variables and members of an unknown receiver are left out.