30 public array $kernel = [];
32 public function __construct(
public int $smoothSize){
33 $bellSize = 1 / $this->smoothSize;
34 $bellHeight = 2 * $this->smoothSize;
36 for($sx = -$this->smoothSize; $sx <= $this->smoothSize; ++$sx){
37 $this->kernel[$sx + $this->smoothSize] = [];
39 for($sz = -$this->smoothSize; $sz <= $this->smoothSize; ++$sz){
40 $bx = $bellSize * $sx;
41 $bz = $bellSize * $sz;
42 $this->kernel[$sx + $this->smoothSize][$sz + $this->smoothSize] = $bellHeight * exp(-($bx * $bx + $bz * $bz) / 2);