I've been playing around with SDL generating 2D patterns like this. The top is the cosine of the distance from the centre, the bottom one is sin X x sin Y.
I'm looking for other simple functions that generate interesting patterns like this. Any suggestions?
Good point. All mathematical images are interesting in one way or another.
I'm just looking for others to try. Preferably in the form of Z = f (X, Y).
The bottom one is interesting because it occurs to me that it's essentially the "depth map" for an acoustic tile. Is that because it's the optimum surface area attainable?
Carter Jackson
Is there nothing then?
Austin Bailey
lookup perlin noise, it's quite fun.
Colton Price
OK now we're cooking! Cheers!
Anthony Ross
You should look into Mathematica if you like this stuff. The two graphics you posted are just
Trying to implement it (stole the code from the wiki page) but I hit a snag - the gradient array. I'll get onto creating that now. It's just 2 floats whose hypotenuse = 1 right?
I don't know that notation (I'm using C++ so it's cos (sqrt ((x * x) + (y * y)) * TWO_PI;))
But that other one - the pic you posted. I want to implement it but not sure how that notation works relative to C++.
Does Perlin noise return a number between -1 and 1 like sin, cos etc?
Cooper Lee
Either way I got a grey screen in my program after creating the gradient array.
Xavier Gray
Read "computers, patterns, chaos and beauty" by clifford pickover
it goes into detail about basically that interference pattern technique (look for fig 13.6)
Also if you give it a bitmask like in this picture you get very unpredictable patterns for basically any bullshit you can think of.
What it is doing is taking x^2 * y where X is the row and Y is the column of the picture and coloring the pixels either black or white based on a single bit of the result.
See also "gosper's hack" or i think it's called "bitwise quilts" by the Donald Knuth "bitwise tips and tricks" art of computer programming text
Luis Hernandez
...
Aiden Walker
std::complex is shit, slow as fuck for no reason
Nicholas Ward
That's pretty cool thanks. I love things like that. I've dabbled in cellular automata programming too.
Charles Richardson
An interesting pattern, iirc is `x XOR y' Or julia fractals rule 110 is also a nice one to try
Luis Long
this is an interesting pattern too, it shouldn't take you too long to translate to whatever method you're using: 10print.org/
Sebastian Morales
it works for literally any old bullshit you can think up
Benjamin Price
I'm assuming you mean XOR when you use the ^ sign?
Parker Myers
Oh didn't see this post. So XOR it is then.
But yeah I like Wolfram automata too. I remember once I tried to get into Game Boy Advance homebrew and because there was no random number generator I made one that did rule 110 on bits. As I recall it didn't generate white noise (I used it to plot "random" dots on the screen.
James Morris
yess
also i think the last one had a typo with the shift direction
it's not versatile because what if you want to add a color? what if you want it to involve an image? what if you are doing this and need OpenGL?
you should be able to just iterate over it as you please like SDL in C++
Nathaniel Ortiz
You can do all of those.
Sure you can't really write a full 3D game in it or something but for these simple one-off images it's fine.
Anthony Morris
>So you see how you can turn a mathematical 2D function into a natural looking texture by adding noise to it.
Is this true for nature too? Somehow if you removed all noise and gave say a tree a perfect environment would its rings be more circular or is noise impossible to remove from that?
And do these mathematical formula have any basis in biology? How does that work
Joshua Wood
this isn't true; std::complex has limitations, but speed is not one of them (assuming you have the proper compiler optimizations enabled)
Jeremiah Cruz
what is your reason for saying this, even? it's well known in competitive programming websites that std::complex is shit and will get you TLEs when it shouldn't, and the de-facto flags for compilation in such a setting includes g++ -O2
John Scott
>what is your reason for saying this, even? because it's a popular opinion among some (including novice and senior programmers) that the standard library sucks and should be avoided, when many of their reasons for why it sucks are based on misinformation
>it's well known in competitive programming websites that std::complex is shit and will get you TLEs when it shouldn't what are these websites? i've seen a few "programming challenge" websites where the top solution (and the vast majority of them to boot) are utter garbage and comments say dumb things like "use a built in dynamic array over a std::vector because it's faster;" maybe you've been visiting better sites than i have
>de-facto flags for compilation in such a setting includes g++ -O2 try -ffast-math
Alexander Ross
forgot your (You):
Bentley Cooper
I mean codeforces and the like, I had problems with complex before and immediately trashed it forever. Sadly I can't choose my compiler flags in this setting (and even if I could, breaking ieee standard seems dangerous)
Nathaniel Clark
What is SDL?
Daniel Perez
OP here. It's s cross-platform API for graphics, sound, etc.
Levi Garcia
I feel like this picture is trying to pull me into the Twilight Zone
Sebastian Murphy
Sick Ducking Lips
John Taylor
You're exaggerating
even if it is slow it's not too slow to use.
who cares for generating fractals anyway. It works
Thomas Anderson
I'm looking for preferably continuous functions, so the XOR one, though interesting, won't be zoomable would it?
Aiden Lewis
it can be zoomable but you would have to start at the lowest level and build it up as much as you want and then zoom in
Luis Flores
True, but what I'm looking for ideally are functions that take two reals and return another real, making zooming trivial.
There have been some interesting ones so far but there must be more surely?
Jonathan Thompson
Read up on aliasing. That's the effect you're seeing in the picture. This theorem is also of interest (tells how to eliminate aliasing, so read it and do the opposite). en.m.wikipedia.org/wiki/Nyquist–Shannon_sampling_theorem The wiki page may be too technical so you may prefer to find a more basic resource. I would suggest looking at intro computer graphics textbooks.
Matlab won't give you the level of control necessary to induce aliasing. Though personally I would use opengl.
Eli Perez
That's not aliasing. That only comes into play if the wavelength of the sine is less than 2 pixels.
Levi Parker
Does anyone know what the formula might be to generate a pattern similar to the "acoustic tile" (bottom half of the top pic), but with the nodes occurring in a honeycomb type arrangement?
Daniel Lewis
>Matlab won't give you the level of control necessary to induce aliasing Why not? Does it automatically anti-alias?
Adam Watson
I found this thing a while ago, and found it to produce some nice stuff once in a while.
If you click on the 'S' button there are all sorts of settings which I presume can be used to alter the random formulas used.