~skeeto/public-inbox

2 2

Re: When Parallel: Pull, Don't Push

Michael Zhang
Details
Message ID
<CAK09u-=p-WpJz8F-Wzn3gr-o9shbmGm1LkGhYi+htBBfnhmOXg@mail.gmail.com>
DKIM signature
missing
Download raw message
Hi, Chris:

This is Michael. Thank you for writing an incredible blog post about
the pull and push model in a simulation. I enjoyed reading that so
much!

for each x, y {

    sx = x + rand(-1, 1)

    sy = y + rand(1, 2)

    output[y][x] = input[sy][sx] - rand(0, 1)

}


Just a quick question, I wonder if the third line of code should be
"sy = y - rand(1, 2)", because the source where y pulls should be
lower than itself. Please let me know. Thank you!


Michael

Re: When Parallel: Pull, Don't Push

Details
Message ID
<20200508130833.53pwohc5zt7ophrw@nullprogram.com>
In-Reply-To
<CAK09u-=p-WpJz8F-Wzn3gr-o9shbmGm1LkGhYi+htBBfnhmOXg@mail.gmail.com> (view parent)
DKIM signature
missing
Download raw message
Thanks for taking the time to reach out about a potential mistake, 
Michael!

That line of code is correct, and I believe this is just a coordinate 
system mix-up. I intend for my example to use traditional screen 
coordinates, particularly because I mentioned VGA, and so the top-left 
corner is the origin, and positive Y is downward. As I understand it, 
this is because the first computer screens were CRT text terminals for 
English speakers. The CRT beam goes left-to-right, top-to-bottom, as did 
humans reading text from the screen. So screen coordinates inherited 
this.

The first example uses "y-1" for the destination to push the flame up a 
row. The second example uses "y+rand()" to reach down 1 or 2 rows to 
pull a flame from above. I've added a note to clarify this:

https://github.com/skeeto/skeeto.github.com/commit/4f8e302

Re: When Parallel: Pull, Don't Push

Michael Zhang
Details
Message ID
<CAK09u-m2131vmNNuJG7iV2zsvS_9YZifKMCuV5DRbCNFhdCtbg@mail.gmail.com>
In-Reply-To
<20200508130833.53pwohc5zt7ophrw@nullprogram.com> (view parent)
DKIM signature
missing
Download raw message
Thank you very much for your detailed explanation. I appreciate that!
Looking forward to more of your insightful tech blog posts!

On Fri, May 8, 2020 at 6:08 AM Christopher Wellons
<wellons@nullprogram.com> wrote:
>
> Thanks for taking the time to reach out about a potential mistake,
> Michael!
>
> That line of code is correct, and I believe this is just a coordinate
> system mix-up. I intend for my example to use traditional screen
> coordinates, particularly because I mentioned VGA, and so the top-left
> corner is the origin, and positive Y is downward. As I understand it,
> this is because the first computer screens were CRT text terminals for
> English speakers. The CRT beam goes left-to-right, top-to-bottom, as did
> humans reading text from the screen. So screen coordinates inherited
> this.
>
> The first example uses "y-1" for the destination to push the flame up a
> row. The second example uses "y+rand()" to reach down 1 or 2 rows to
> pull a flame from above. I've added a note to clarify this:
>
> https://github.com/skeeto/skeeto.github.com/commit/4f8e302
Reply to thread Export thread (mbox)