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?
What would make a pattern boring?
>>8602399
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?
Is there nothing then?
>>8602455
lookup perlin noise, it's quite fun.
>>8602471
OK now we're cooking! Cheers!
You should look into Mathematica if you like this stuff. The two graphics you posted are just
DensityPlot[Cos[Norm[{x, y}]], {x, -40, 40}, {y, -40, 40},
ColorFunction -> GrayLevel, PlotPoints -> 50]
and
DensityPlot[Sin[x] Cos[y], {x, -20, 20}, {y, -20, 20},
ColorFunction -> GrayLevel, PlotPoints -> 50]
Pic related is
DensityPlot[Im[ArcTan[(x + I y)^3]], {x, -2, 2}, {y, -2, 2},
ColorFunction -> GrayLevel, PlotPoints -> 50]
>>8602511
The Wolfram shills are back I see
>>8602515
t. MathWorks shill
>>8602515
>it's shill to recommend a genuinely better tool for what OP is doing than raw SDL
Here's
DensityPlot[Im[ArcCsch[(x + I y)^3]], {x, -2, 2}, {y, -2, 2},
ColorFunction -> GrayLevel, PlotPoints -> 50, PlotTheme -> "Minimal"]
>>8602471
>>8602475
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?
>>8602511
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++.
>>8602535
http://en.cppreference.com/w/cpp/numeric/complex
Does Perlin noise return a number between -1 and 1 like sin, cos etc?
>>8602643
Either way I got a grey screen in my program after creating the gradient array.
>>8602385
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
>>8602385
>>8602567
std::complex is shit, slow as fuck for no reason
>>8602776
That's pretty cool thanks. I love things like that. I've dabbled in cellular automata programming too.
An interesting pattern, iirc is `x XOR y'
Or julia fractals
rule 110 is also a nice one to try
>>8602857
this is an interesting pattern too, it shouldn't take you too long to translate to whatever method you're using:
http://10print.org/
>>8602837
it works for literally any old bullshit you can think up
>>8602867
I'm assuming you mean XOR when you use the ^ sign?
>>8602857
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.
>>8602870
yess
also i think the last one had a typo with the shift direction
>>8602857
>>8602880
>>8602857
it's comparable to a Sierpinski triangle
http://lodev.org/cgtutor/randomnoise.html
Just found this - gonna have to study this some time. I've got work in the morning so I'm off for a bit...
>>8602531
that's confusing as hell and not half as versatile as C++/SDL
>>8602385
What if you use a combination of discrete cosine transforms to compress literally any image?
>>8602944
>Confusing as hell
>Literally a single function call with a few options set with documentation out the ass ( http://reference.wolfram.com/language/ref/DensityPlot.html )
As for "not as versatile", how so?
>>8603037
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.
>>8602885
>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
>>8602804
this isn't true; std::complex has limitations, but speed is not one of them (assuming you have the proper compiler optimizations enabled)
>>8603207
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
>>8603207
>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
>>8603236
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)
>>8602385
What is SDL?
>>8603454
OP here. It's s cross-platform API for graphics, sound, etc.
>>8602385
I feel like this picture is trying to pull me into the Twilight Zone
>>8603454
Sick Ducking Lips
>>8602804
You're exaggerating
even if it is slow it's not too slow to use.
who cares for generating fractals anyway. It works
I'm looking for preferably continuous functions, so the XOR one, though interesting, won't be zoomable would it?
>>8606724
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
>>8606857
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?
>>8602385
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).
https://en.m.wikipedia.org/wiki/Nyquist%E2%80%93Shannon_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.
>>8602531
Matlab won't give you the level of control necessary to induce aliasing. Though personally I would use opengl.
>>8607957
That's not aliasing. That only comes into play if the wavelength of the sine is less than 2 pixels.
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?
>>8607957
>Matlab won't give you the level of control necessary to induce aliasing
Why not? Does it automatically anti-alias?
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.
http://herzig.github.io/eqgen/
>>8609941
that's not likely to be intuitive / simple
you're better off just doing it in Gimp