POV-Ray : Newsgroups : povray.advanced-users : Direct stochastic tiling Server Time16 Sep 2024 23:10:47 EDT (-0400)
 Direct stochastic tiling (Message 1 to 10 of 26)
 From: Bald Eagle Subject: Direct stochastic tiling Date: 20 Sep 2023 22:05:00 Message:
```
{
"@context": "https://schema.org",
"@type": "DiscussionForumPosting",
"@id": "#web.650ba428c90fe1dd1f9dae3025979125%40news.povray.org",
"dateCreated": "2023-09-21T02:05:00+00:00",
"datePublished": "2023-09-21T02:05:00+00:00",
"author": {
"@type": "Person",
"name": "Bald Eagle"
}
}
Following through a long train of papers and references therein, I picked a part
of one that looked "simple" to implement.

The attached is a "Direct stochastic tiling" pattern that assigns any unit
square a random, but calculable Wang tile.  The edge color of any Wang tile
matches the edge of any adjacent Wang tile.

https://graphics.cs.kuleuven.be/publications/LD05PODF/LD05PODF_paper.pdf

Since it's a pattern, it's all functions.

Would you like to not lose your mind trying to figure out why patterns don't do
what you think they're supposed to do?  Especially across the origin?
Stop using mod (), and use the user-defined function:

#declare fmod = function (N, Modulo) {select (N, 1-mod(abs(N), Modulo), mod
(abs(N), Modulo))}

And use that wherever you need x, y, or z in a repeating unit-square pattern.

- BE
```

Attachments:

Preview of image 'direct stochastic tiling.png'

 From: Bald Eagle Subject: Re: Direct stochastic tiling Date: 21 Sep 2023 06:25:00 Message:
```
{
"@context": "https://schema.org",
"@type": "DiscussionForumPosting",
"@id": "#web.650c19af5bb87ec31f9dae3025979125%40news.povray.org",
"dateCreated": "2023-09-21T10:25:00+00:00",
"datePublished": "2023-09-21T10:25:00+00:00",
"author": {
"@type": "Person",
"name": "Bald Eagle"
}
}
"Bald Eagle" <cre### [at] netscapenet> wrote:

> Would you like to not lose your mind trying to figure out why patterns don't do
> what you think they're supposed to do?

After I posted this, I was looking at the rendered pattern, and noticed that
there was a lot of red, and very very little yellow, and since there's been
commentary on just how improbably it is to get an actual 1 or 0 from the PRNG, I
wondered what the spread of f_noise3d in functions.inc was.

It sucks.

After a few failed attempts to coax the output to cover a greater range, I took
5 noise samples at scales increasing by powers of 10, and did 1+2-3+4-5, and
then folded any out of range results back in with 2 nested select () functions.
That seemed to give a much more uniformly distributed random result, and a much
more varied coloration to the pattern.

- BE
```

Attachments:

Preview of image 'direct stochastic tiling.png'

 From: Bald Eagle Subject: Re: Direct stochastic tiling Date: 21 Sep 2023 06:30:00 Message:
```
{
"@context": "https://schema.org",
"@type": "DiscussionForumPosting",
"@id": "#web.650c1a905bb87ec31f9dae3025979125%40news.povray.org",
"dateCreated": "2023-09-21T10:30:00+00:00",
"datePublished": "2023-09-21T10:30:00+00:00",
"author": {
"@type": "Person",
"name": "Bald Eagle"
}
}
Also, here's a zoomed-in version, with thicker borders, and some rgb 0 cylinders
to separate the unit squares so that the tile structure is a lot more evident.

Not sure I'm looking forward to the Poisson disk part of this....
```

Attachments:

Preview of image 'direct stochastic tiling.png'

 From: ingo Subject: Re: Direct stochastic tiling Date: 21 Sep 2023 08:40:00 Message:
```
{
"@context": "https://schema.org",
"@type": "DiscussionForumPosting",
"@id": "#web.650c39405bb87ec317bac71e8ffb8ce3%40news.povray.org",
"dateCreated": "2023-09-21T12:40:00+00:00",
"datePublished": "2023-09-21T12:40:00+00:00",
"author": {
"@type": "Person",
"name": "ingo"
}
}
"Bald Eagle" <cre### [at] netscapenet> wrote:

> Not sure I'm looking forward to the Poisson disk part of this....

There is a poisson distribution in rand.inc, if it helps.

ingo
```
 From: Bald Eagle Subject: Re: Direct stochastic tiling Date: 21 Sep 2023 20:40:00 Message:
```
{
"@context": "https://schema.org",
"@type": "DiscussionForumPosting",
"@id": "#web.650ce1c85bb87ec31f9dae3025979125%40news.povray.org",
"dateCreated": "2023-09-22T00:40:00+00:00",
"datePublished": "2023-09-22T00:40:00+00:00",
"author": {
"@type": "Person",
"name": "Bald Eagle"
}
}
"ingo" <nomail@nomail> wrote:
> "Bald Eagle" <cre### [at] netscapenet> wrote:
>
> > Not sure I'm looking forward to the Poisson disk part of this....
>
> There is a poisson distribution in rand.inc, if it helps.
>
> ingo

Thanks, but I went over that several times, and can't for the life of me figure
out what that does or how to implement / visualize it.  I think that somehow
that's a "different" Poisson distribution.

"The number of point in an area A is Poisson-distributed with mean equal to the
area times the density. For this reason, the distribution is often called a
Poisson distribution.  This unfortunate terminology should not be confused with
the univariate discrete Poisson distribution."
http://www.dgp.toronto.edu/~elf/.misc/poissondisk.pdf (bottom of pg 3)

I think that basically what I need is:

https://editor.p5js.org/codingtrain/sketches/4N78DFCXN

https://github.com/SebLague/Poisson-Disc-Sampling/tree/master/Poisson%20Disc%20Sampling%20E01

I have coded the first one, but it doesn't work, because I probably messed up my
push/splice macros, and I have to work out the array indices, because those are
going awry as always.   :/

These "computer science" papers are all shit - since there's no code, and
therefore no way to verify/reproduce their work.  As a chemist, I had to give a
full, detailed experimental procedure, plus physical characteristics, spectral
data, etc.

"Find the center of gravity of the Voronoi region...."
Oh yeah, buddy.   Go cut down the tallest tree in the forest with .... A
HERRING!

- BW
```

Attachments:

 From: ingo Subject: Re: Direct stochastic tiling Date: 22 Sep 2023 01:35:00 Message:
```
{
"@context": "https://schema.org",
"@type": "DiscussionForumPosting",
"@id": "#web.650d264f5bb87ec317bac71e8ffb8ce3%40news.povray.org",
"dateCreated": "2023-09-22T05:35:00+00:00",
"datePublished": "2023-09-22T05:35:00+00:00",
"author": {
"@type": "Person",
"name": "ingo"
}
}
"Bald Eagle" <cre### [at] netscapenet> wrote:

> These "computer science" papers are all shit

Have you tried a search engine lately? Top 20 lists ... Stupid AI's ....

ingo <ducks and hides>
```
 From: Bald Eagle Subject: Re: Direct stochastic tiling Date: 22 Sep 2023 06:30:00 Message:
```
{
"@context": "https://schema.org",
"@type": "DiscussionForumPosting",
"@id": "#web.650d6c005bb87ec31f9dae3025979125%40news.povray.org",
"dateCreated": "2023-09-22T10:30:00+00:00",
"datePublished": "2023-09-22T10:30:00+00:00",
"author": {
"@type": "Person",
"name": "Bald Eagle"
}
}
"ingo" <nomail@nomail> wrote:
> "Bald Eagle" <cre### [at] netscapenet> wrote:
>
> > These "computer science" papers are all shit
>
> Have you tried a search engine lately? Top 20 lists ... Stupid AI's ....
>
> ingo <ducks and hides>

Yeah - they're all changing - for the worst.

I used to used duck duck go for a bit - until they sold out.
Then I switched primarily to Brave, but they stopped having useful search
results.
I find myself using Yandex a lot.

It's painful to have lived through "the golden age of the internet" and know
that all that stuff is out there  ---- somewhere.

The other thing that I find strange is that I'll get a list of search results,
and when I click on one of the top ones, the site is nonexistent.  So then
what's the result doing in the list?  How do I have an image thumbnail that goes
along with it, but can't get anywhere to see the image???

It's getting really weird.
```
 From: kurtz le pirate Subject: Re: Direct stochastic tiling Date: 22 Sep 2023 11:25:49 Message: <650db1fd@news.povray.org>
```
{
"@context": "https://schema.org",
"@type": "DiscussionForumPosting",
"@id": "#650db1fd%40news.povray.org",
"dateCreated": "2023-09-22T15:25:49+00:00",
"datePublished": "2023-09-22T15:25:49+00:00",
"author": {
"@type": "Person",
"name": "kurtz le pirate"
}
}
On 22/09/2023 02:37, Bald Eagle wrote:

> I have coded the first one, but it doesn't work, because I probably messed up my
> push/splice macros, and I have to work out the array indices, because those are
> going awry as always.   :/

--
Kurtz le pirate
Compagnie de la Banquise
```

Attachments:

 From: Bald Eagle Subject: Re: Direct stochastic tiling Date: 22 Sep 2023 14:05:00 Message:
```
{
"@context": "https://schema.org",
"@type": "DiscussionForumPosting",
"@id": "#web.650dd70d5bb87ec31f9dae3025979125%40news.povray.org",
"dateCreated": "2023-09-22T18:05:00+00:00",
"datePublished": "2023-09-22T18:05:00+00:00",
"author": {
"@type": "Person",
"name": "Bald Eagle"
}
}
kurtz le pirate <kur### [at] gmailcom> wrote:

Yes Sir, that would probably help me avoid debugging THAT part, and see what
else I've buggered up.

Thanks - that's very nice little collection of very useful macros!   :)

- BW
```
 From: Bald Eagle Subject: Re: Direct stochastic tiling Date: 22 Sep 2023 19:35:00 Message:
```
{
"@context": "https://schema.org",
"@type": "DiscussionForumPosting",
"@id": "#web.650e23985bb87ec31f9dae3025979125%40news.povray.org",
"dateCreated": "2023-09-22T23:35:00+00:00",
"datePublished": "2023-09-22T23:35:00+00:00",
"author": {
"@type": "Person",
"name": "Bald Eagle"
}
}
kurtz le pirate <kur### [at] gmailcom> wrote:

One thing that I did notice is that I'm splicing out array entries until I have
an empty array.

That was triggering an invalid array size error, which I fixed / worked around
by doing:

#if (newSize <= 0)
#local tmpArray = array;
#else
#local tmpArray = array[newSize]
#end

and

#if (newSize <= 0)
#declare thisArray = array;
#else
#declare thisArray = array[newSize]
#end

Maybe do some further testing and see what you think, then update that last
macro.

- BW
```