CodingTrain / CodingTrain/Suggestion-Box

Water ripples in tf.js

Open
#963 6 comments 0 reactions 1 assignee Claimed by @shiffman View on GitHub
Dominant language
No language data
Stars
570
Forks
85
PR merge metrics
No merged PRs in 30d

Description

During live session I've noticed, that this pseudo-code
```
for every non-edge element:
loop
Buffer2(x, y) = (Buffer1(x - 1, y) +
Buffer1(x + 1, y) +
Buffer1(x, y + 1) +
Buffer1(x, y - 1)) / 2 - Buffer2(x, y)
Buffer2(x, y) = Buffer2(x, y) * damping
end loop
```
can be rewritten in terms of matrices:
```
Buffer2 = conv2d(Buffer1, kernel) - Buffer2
Buffer2 *= damping
```
where `kernel` is a 3*3 matrix of the following
```
[[0.0 0.5 0.0],
[0.5 0.0 0.5],
[0.0 0.5 0.0]]
```
Perhaps, it would be easier to explain what is convolution on this example

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.