From ac66ee66444998f1713729ef460c7fd018af2eb2 Mon Sep 17 00:00:00 2001 From: nakednous Date: Sun, 24 Oct 2021 09:18:46 -0500 Subject: [PATCH] filter api docs updated; version 0.2.1 --- p5.quadrille.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/p5.quadrille.js b/p5.quadrille.js index 35f03ae..435fd68 100644 --- a/p5.quadrille.js +++ b/p5.quadrille.js @@ -300,13 +300,18 @@ class Quadrille { // TODO toAscii() /** - * Convolutes this quadrille against the quadrille kernel mask. + * Convolutes this quadrille at (row,col) against the quadrille kernel mask. + * Convolutes the whole quadrille if either row or col is 0. + * Both i and j should be greater or equal than the mask half_size + * (computed as (mask.width - 1) / 2), in any other case. * @params {Quadrille} nxn (n is odd) quadrille convolution kernel mask. + * @param {number} row if 0 convolutes the whole quadrille + * @param {number} col if 0 convolutes the whole quadrille */ filter(mask, row=0, col=0) { if (mask.size % 2 === 1 && mask.width === mask.height && this.size >= mask.size) { let half_size = (mask.width - 1) / 2; - if (row==0 && col==0) { + if (row==0 || col==0) { for (let i = half_size; i < this.height - half_size; i++) { for (let j = half_size; j < this.width - half_size; j++) { this._conv(mask, i, j, half_size);