•      Sign In
• Create Account

We're offering banner ads on our site from just \$5!

fractal result by accident

Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

47 replies to this topic

#21Brother Bob  Moderators   -  Reputation: 8566

Like
0Likes
Like

Posted 06 February 2014 - 04:29 AM

what is interfering with what?

It has been said many times already; the circular pattern is interfering with the pixel sampling grid. At the center of the ball, the frequency of the circular patterns are low and do not alias when you sample it at the discrete pixel locations. At the higher frequencies, the circular patterns do alias becuase you cannot capture the high frequency details with the low sampling frequency. That is where the interference patterns are coming from.

Sponsor:

#22 fir   Members   -  Reputation: -456

Like
0Likes
Like

Posted 06 February 2014 - 04:35 AM

what is interfering with what?

It has been said many times already; the circular pattern is interfering with the pixel sampling grid. At the center of the ball, the frequency of the circular patterns are low and do not alias when you sample it at the discrete pixel locations. At the higher frequencies, the circular patterns do alias becuase you cannot capture the high frequency details with the low sampling frequency. That is where the interference patterns are coming from.

this is not dependant at grid resolution if you will have many times larger grid of pixels you will see a wide waves of color, grid is not more important for visualisation here as with normal bitmap thing - it does not produce the effect only downsamples it - so i still not see where is interference here i do not see it, the image isa an effect of colouring not

intefrerention (image as i said is 'downsampled' but this is the same like when for example mandelbrot set visualization or raytracing images visualisation)

Edited by fir, 06 February 2014 - 04:38 AM.

#23PeterStock  Members   -  Reputation: 396

Like
1Likes
Like

Posted 06 February 2014 - 06:59 AM

I am impressed with the patience shown here. It's a Moire pattern.

#24 fir   Members   -  Reputation: -456

Like
-3Likes
Like

Posted 06 February 2014 - 07:43 AM

I am impressed with the patience shown here. It's a Moire pattern.

For me it seem s that moire is some broad class of visuals, and this one kind is some specyfic type of fractal - maybe deserves its own name (i dont know, im not sure). For me it is interesting object maybe i will do a little explorer of it later..

#25aregee  Members   -  Reputation: 1026

Like
0Likes
Like

Posted 06 February 2014 - 09:23 AM

See:

https://www.google.no/search?q=moire+pattern&espv=210&es_sm=119&source=lnms&tbm=isch&sa=X&ei=4KTzUqDvDOrMygPYhoGIBw&sqi=2&ved=0CAcQ_AUoAQ&biw=1920&bih=898

On any of those pictures:

Since the TV that I use with my computer has a resolution that doesn't quite match up with the natural resolution of the graphic card, I get Moire patterns exactly like yours when I have zoomed completely out.  When I zoom in, the pattern disappear.  The pictures are static.  (CTRL + mouse scroll on Mac to zoom, or what you have configured.  Not sure how to activate on Windows any more.)

You will probably not see the same result, unless you pick a resolution that does not quite match up with the resolution on the screen, but the reason is the same: ALIASING.  Aliasing makes Moire patterns.

Aliasing happens when you show high frequency data on a low(er) frequency medium.

Have a look here: http://www.svi.nl/AliasingArtifacts

Even TV / video producers avoid having certain clothes to avoid aliasing effects.  You don't often see clothes with high contrast horizontal stripes, for instance: http://www.assetmediagroup.com/what-to-wear-for-video-shoot.html

Edited by aregee, 06 February 2014 - 09:34 AM.

#26Álvaro  Crossbones+   -  Reputation: 13880

Like
2Likes
Like

Posted 06 February 2014 - 09:37 AM

i dont know how to count a dimension do you know how to count this based on that picture?

Fractals are not pretty pictures: They are subsets of R^n with certain self-similarity properties. So you have to start by defining a subset of R^n in some way. A picture doesn't help much.

#27 fir   Members   -  Reputation: -456

Like
-3Likes
Like

Posted 06 February 2014 - 09:41 AM

See:

https://www.google.no/search?q=moire+pattern&espv=210&es_sm=119&source=lnms&tbm=isch&sa=X&ei=4KTzUqDvDOrMygPYhoGIBw&sqi=2&ved=0CAcQ_AUoAQ&biw=1920&bih=898

On any of those pictures:

Since the TV that I use with my computer has a resolution that doesn't quite match up with the natural resolution of the graphic card, I get Moire patterns exactly like yours when I have zoomed completely out.  When I zoom in, the pattern disappear.  The pictures are static.  (CTRL + mouse scroll on Mac to zoom, or what you have configured.  Not sure how to activate on Windows any more.)

You will probably not see the same result, unless you pick a resolution that does not quite match up with the resolution on the screen, but the reason is the same: ALIASING.  Aliasing makes Moire patterns.

Aliasing happens when you show high frequency data on a low(er) frequency medium.

Have a look here: http://www.svi.nl/AliasingArtifacts

Even TV / video producers avoid having certain clothes to avoid aliasing effects.  You don't often see clothes with high contrast horizontal stripes, for instance: http://www.assetmediagroup.com/what-to-wear-for-video-shoot.html

so, explain me - you think that underlaying image is something 'less

fractal' and only presenting it on the pixelgrid makes it looking fractal-like?

I do not see the reason to belive that underlying image is something much simpler that the thing you see on the grid (for hihg frequenzy palette I think it is more complex than the thing you see)

so if this is not true i do not get why to force me to belive in this.;\

#28aregee  Members   -  Reputation: 1026

Like
6Likes
Like

Posted 06 February 2014 - 10:20 AM

I am going to give it another try:

And lastly similar to your effect:

Unfortunately it is poor quality, but you get the point.

#29 fir   Members   -  Reputation: -456

Like
-4Likes
Like

Posted 06 February 2014 - 10:42 AM

I am going to give it another try:

Unfortunately it is poor quality, but you get the point.

the last didnt work, the third was interesting

what point? the difference of opinions was on the topics if

1) this is a fractal

2) if this is a result of an interference (related to 'presentation artifact')

above with such moire there was two drawings interfering, in my example  algorithm i just calculate the pixel color with given not

complex function then set pixel and i just doubt (and tend to disagree)

if the resulting  'fractal pattern' comes from the discretization to grid values, imo it seems that underlying 'fluid' function has it implied

it may be related to some "inner" interferency of parts of its math formula

but probably is not related to screen presentation artifacts

but do not matter i doubt this is worth talking to much, i was interested

more if this specyfic ball fractal-like moire - like object has a specyfic name

(as to moire i was not denying that it may be somewhat related but i said that moire seem to be a whole family not the specyfic one, and maybe there is some specyfic name,

as to being a fractal i am not seeing if this is a worse object to

being fractal that for example

http://en.wikipedia.org/wiki/Sierpinski_carpet

which seem to be somewhat resemblin this ball i was talking about here)

Edited by fir, 06 February 2014 - 10:51 AM.

#30Álvaro  Crossbones+   -  Reputation: 13880

Like
8Likes
Like

Posted 06 February 2014 - 01:51 PM

As everyone suspected, it's just a Moiré pattern. Here's my attempt at producing it:

#include <cstdio>
#include <cmath>

int main() {
std::puts("# ImageMagick pixel enumeration: 800,800,255,srgb");

for (int j=0; j<800; ++j) {
double y = (400.0 - j) / 360.0;
for (int i=0; i<800; ++i) {
double x = (i - 400.0) / 360.0;
double z2 = 1.0 - x * x - y * y;
double distance = (z2 >= 0.0) ? std::sqrt(z2) : 0.0;
double color = std::fmod(1000.0*distance, 1.0);
int r = 256 * color;
int g = 256 * color;
int b = 256 * (1.0 - color);
r = r > 255 ? 255 : r < 0 ? 0 : r;
g = g > 255 ? 255 : g < 0 ? 0 : g;
b = b > 255 ? 255 : b < 0 ? 0 : b;
std::printf("%d,%d: (%d,%d,%d)  #%02X%02X%02X  srgb(%d,%d,%d)\n",
i, j,
r, g, b,
r, g, b,
r, g, b);
}
}
}



I compiled that code and then executed it, passing the output through | convert TXT:- output.png' (convert' is a command-line utility, part of ImageMagick). The output is this:

[EDIT: If you replace 1000.0 with something like 250.0, you'll get an image much closer to the original in this thread.]

Edited by Álvaro, 06 February 2014 - 01:54 PM.

#31unbird  Crossbones+   -  Reputation: 5990

Like
3Likes
Like

Posted 06 February 2014 - 03:03 PM

This is fun. I think I remember the formula for the last video from aregee. Had copy the link manually, but the resolution is really bad, therefore...

C# code (console app, copy paste, add reference for System.Drawing)
using System;
using System.Collections.Generic;
using System.Linq;
using System.Drawing;
using System.Drawing.Imaging;
using System.Text;

namespace Moire
{
class Program
{
static void Main(string[] args)
{
int width = 640;
int height = 480;
var scale = 50.0;
scale /= height; // adjust for resolution
var xh = width / 2;
var yh = height / 2;
var bitmap = new Bitmap(width, height);
for (int y = 0; y < height; y++)
{
var yy = (y - yh) * scale;
for (int x = 0; x < width; x++)
{
var xx = (x - xh) * scale;
var value = xx * xx + yy * yy;  // f(x,y) = x^2 + y ^ 2
value = value % 1.0;            // mod, though Hue should actually wrap anyway
var color = Hue((float)value);
bitmap.SetPixel(x, y, color);
}
}
bitmap.Save("image.png", ImageFormat.Png);
bitmap.Dispose();
}

#region Color functions
public static byte ToByte(float value)
{
return (byte)System.Math.Max(0, System.Math.Min(255, System.Math.Round(255f * value)));
}

public static Color FromFloat(float r, float g, float b)
{
return Color.FromArgb(ToByte(r), ToByte(g), ToByte(b));
}

public static Color Hue(float hue)
{
float oneSixth = 1f / 6f;
float h = hue - (int)hue;
int index = (int)(h / oneSixth);
h = (h / oneSixth) - index;
var q = 1f - h;
switch (index)
{
case 0: return FromFloat(1, h, 0);
case 1: return FromFloat(q, 1, 0);
case 2: return FromFloat(0, 1, h);
case 3: return FromFloat(0, q, 1);
case 4: return FromFloat(h, 0, 1);
default: return FromFloat(1, 0, q);
}
}
#endregion

}
}


Playing with the scale:
scale = 10

scale = 20

scale = 50

#32samoth  Crossbones+   -  Reputation: 5031

Like
0Likes
Like

Posted 06 February 2014 - 04:58 PM

Fractals are not pretty pictures: They are subsets of R^n with certain self-similarity properties. So you have to start by defining a subset of R^n in some way. A picture doesn't help much.
It kind of does, to dismiss it as fractal. Even if the term "subsets of R^n" produces a "Huh, WTF?" reaction inside you, you can still very clearly see that the pattern is not self-similar.

If this was a fractal, there should be little concentric circles inside the pretty colorful concentric circles. No such thing as even a single odd pixel that doesn't fit into the pretty gradients can be seen in the original picture, nor when you zoom in.

#33 fir   Members   -  Reputation: -456

Like
-3Likes
Like

Posted 07 February 2014 - 01:02 AM

Fractals are not pretty pictures: They are subsets of R^n with certain self-similarity properties. So you have to start by defining a subset of R^n in some way. A picture doesn't help much.
It kind of does, to dismiss it as fractal. Even if the term "subsets of R^n" produces a "Huh, WTF?" reaction inside you, you can still very clearly see that the pattern is not self-similar.

If this was a fractal, there should be little concentric circles inside the pretty colorful concentric circles. No such thing as even a single odd pixel that doesn't fit into the pretty gradients can be seen in the original picture, nor when you zoom in.

If sierpiński carpet is a fractal i see no reazon for this to be not fractal ;\

we should ask some mathematician good in fractals, for answer why  ifsierpiński is a fractal this  ball is not ;\

For me it looks like a interferency of circular vaves made by sierpiński like raindrop

#34 fir   Members   -  Reputation: -456

Like
0Likes
Like

Posted 07 February 2014 - 01:06 AM

As everyone suspected, it's just a Moiré pattern. Here's my attempt at producing it:

#include <cstdio>
#include <cmath>

int main() {
std::puts("# ImageMagick pixel enumeration: 800,800,255,srgb");

for (int j=0; j<800; ++j) {
double y = (400.0 - j) / 360.0;
for (int i=0; i<800; ++i) {
double x = (i - 400.0) / 360.0;
double z2 = 1.0 - x * x - y * y;
double distance = (z2 >= 0.0) ? std::sqrt(z2) : 0.0;
double color = std::fmod(1000.0*distance, 1.0);
int r = 256 * color;
int g = 256 * color;
int b = 256 * (1.0 - color);
r = r > 255 ? 255 : r < 0 ? 0 : r;
g = g > 255 ? 255 : g < 0 ? 0 : g;
b = b > 255 ? 255 : b < 0 ? 0 : b;
std::printf("%d,%d: (%d,%d,%d)  #%02X%02X%02X  srgb(%d,%d,%d)\n",
i, j,
r, g, b,
r, g, b,
r, g, b);
}
}
}



I compiled that code and then executed it, passing the output through | convert TXT:- output.png' (convert' is a command-line utility, part of ImageMagick). The output is this:

[EDIT: If you replace 1000.0 with something like 250.0, you'll get an image much closer to the original in this thread.]

Very good work! I see the central part is probably

distance = sqrt(1-(x*x+y*y))

do you know maybe what klind of function it is id drawed z=f(x,y)

of just z=f(x,0); ?

Im rarely doing mathematics so i forgot the thing

As to moire pattern I suspect this could be treated set of infinite number of moire interferentions - but those interferentions are purely mathematical not 'presentation aliasing' artifacts

Edited by fir, 07 February 2014 - 01:10 AM.

#35 fir   Members   -  Reputation: -456

Like
0Likes
Like

Posted 07 February 2014 - 01:11 AM

This is fun. I think I remember the formula for the last video from aregee. Had copy the link manually, but the resolution is really bad, therefore...

C# code (console app, copy paste, add reference for System.Drawing)

using System;
using System.Collections.Generic;
using System.Linq;
using System.Drawing;
using System.Drawing.Imaging;
using System.Text;

namespace Moire
{
class Program
{
static void Main(string[] args)
{
int width = 640;
int height = 480;
var scale = 50.0;
scale /= height; // adjust for resolution
var xh = width / 2;
var yh = height / 2;
var bitmap = new Bitmap(width, height);
for (int y = 0; y < height; y++)
{
var yy = (y - yh) * scale;
for (int x = 0; x < width; x++)
{
var xx = (x - xh) * scale;
var value = xx * xx + yy * yy;  // f(x,y) = x^2 + y ^ 2
value = value % 1.0;            // mod, though Hue should actually wrap anyway
var color = Hue((float)value);
bitmap.SetPixel(x, y, color);
}
}
bitmap.Save("image.png", ImageFormat.Png);
bitmap.Dispose();
}

#region Color functions
public static byte ToByte(float value)
{
return (byte)System.Math.Max(0, System.Math.Min(255, System.Math.Round(255f * value)));
}

public static Color FromFloat(float r, float g, float b)
{
return Color.FromArgb(ToByte(r), ToByte(g), ToByte(b));
}

public static Color Hue(float hue)
{
float oneSixth = 1f / 6f;
float h = hue - (int)hue;
int index = (int)(h / oneSixth);
h = (h / oneSixth) - index;
var q = 1f - h;
switch (index)
{
case 0: return FromFloat(1, h, 0);
case 1: return FromFloat(q, 1, 0);
case 2: return FromFloat(0, 1, h);
case 3: return FromFloat(0, q, 1);
case 4: return FromFloat(h, 0, 1);
default: return FromFloat(1, 0, q);
}
}
#endregion

}
}


Playing with the scale:
scale = 10

scale = 20

scale = 50

nice, good work

#36samoth  Crossbones+   -  Reputation: 5031

Like
2Likes
Like

Posted 07 February 2014 - 04:12 AM

If sierpiński carpet is a fractal i see no reazon for this to be not fractal ;\

That is like saying: If a circle is round, I see no reason why a square should not be.

A Sierpinski carpet (or triangle) has the "stereotypical look" of a fractal, which your image just doesn't have. Note that looking like a fractal doesn't make an image a fractal, but not looking like one at all rules it out pretty safely.

If you look at a Sierpinski triangle starting at level 1, it has the look of a filled triangle where an upside-down triangle has been cut out (it works if you start with the level-0 triangle too, but I find the similarity more striking if you start at one subdivision). That exact same pattern is visible in each of the three smaller filled triangles around that cut-out triangle, and in each of the three even smaller triangles inside these, and so on. You can repeat this ad infinitum, and it will always look the same.

If you look at your image, there are circles and rings, and yes they are somewhat similar, arranged in a somewhat repeating texture. But that's where it stops. If you zoom into one of the circles, it doesn't turn out being an orb with many smaller circles and rings. It's just a circle.

This, too, is a regular, repeating pattern, but it is not fractal:

we should ask some mathematician good in fractals, for answer why  ifsierpiński is a fractal this  ball is not ;\

Well, one mathematician already gave an explanation a dozen or so posts above.

Edited by samoth, 07 February 2014 - 04:16 AM.

#37 fir   Members   -  Reputation: -456

Like
-2Likes
Like

Posted 07 February 2014 - 04:44 AM

If sierpiński carpet is a fractal i see no reazon for this to be not fractal ;\

That is like saying: If a circle is round, I see no reason why a square should not be.

A Sierpinski carpet (or triangle) has the "stereotypical look" of a fractal, which your image just doesn't have. Note that looking like a fractal doesn't make an image a fractal, but not looking like one at all rules it out pretty safely.

If you look at a Sierpinski triangle starting at level 1, it has the look of a filled triangle where an upside-down triangle has been cut out (it works if you start with the level-0 triangle too, but I find the similarity more striking if you start at one subdivision). That exact same pattern is visible in each of the three smaller filled triangles around that cut-out triangle, and in each of the three even smaller triangles inside these, and so on. You can repeat this ad infinitum, and it will always look the same.

If you look at your image, there are circles and rings, and yes they are somewhat similar, arranged in a somewhat repeating texture. But that's where it stops. If you zoom into one of the circles, it doesn't turn out being an orb with many smaller circles and rings. It's just a circle.

This, too, is a regular, repeating pattern, but it is not fractal:

Probably when increasing the palette frequency inifinitely you will get infinite level of depth in such circle patterns - you ignore this thing or you do not understand? Im not sure but maybe there can be stated that if you will get any small rectangle area you will find a circles in it (though maybe some vaves may be much  smaller than dominant one

for me i may repeat it seem this is not worse fractal than sierpiński carpet

I wonder if 3d version of it could be obtained? maybe someone will know? (this is maybe more 2d than 3d and i wonder if real spheric

3d versiion surface is obtainable and which formula?)

PS Alvaro could ypu maybe rise up the visuals by inventing more colorfull palette here (more like unbird did)? (I cannot work on this today but would be curious if this could be more colorfull)

Edited by fir, 07 February 2014 - 04:48 AM.

#38samoth  Crossbones+   -  Reputation: 5031

Like
3Likes
Like

Posted 07 February 2014 - 05:04 AM

It should look something similar to this:

(that's a Sierpinski carpet with circles)

#39Álvaro  Crossbones+   -  Reputation: 13880

Like
4Likes
Like

Posted 07 February 2014 - 05:23 AM

for me i may repeat it seem this is not worse fractal than sierpiński carpet

Take a square. If you scale it up by a factor of 3 in every direction, you get a figure composed of 9 copies of the original square. We can then define the dimension of the square as log(9)/log(3)=2 (that is, what power of the scaling factor gives you the number of copies).

If you scale the Sierpinski carpet up by a factor of 3 in every direction, you get a figure composed of 8 copies of the original Sierpinski carpet. Therefore its dimension is log(8)/log(3) = 1.89278926071437231130... That's why we call that a fractal.

I have no idea why you still think your image is a fractal. The way I see it, what you plotted is a couple of hundred concentric circles, which when sampled with a regular grid result in a spectacular moiré pattern. It's not like we are saying your image isn't pretty: It just has little to do with fractals.

I found this link: http://www.nahee.com/spanky/www/fractint/circle_type.html (Notice the "not a fractal" part.)

#40 fir   Members   -  Reputation: -456

Like
-4Likes
Like

Posted 07 February 2014 - 07:00 AM

for me i may repeat it seem this is not worse fractal than sierpiński carpet

I have no idea why you still think your image is a fractal. The way I see it, what you plotted is a couple of hundred concentric circles, which when sampled with a regular grid result in a spectacular moiré pattern. It's not like we are saying your image isn't pretty: It just has little to do with fractals.

I found this link: http://www.nahee.com/spanky/www/fractint/circle_type.html (Notice the "not a fractal" part.)

I think it is unrelated to sampling on the grid- all in all this is well defined

F(x,y) function for x,y are real,  - so sampling to a grid is not important imo, it just blurs the details, dont you think?

Very good info in this link, (i was searching for such references) though here is written ". The resulting image is not a fractal because all detail is lost after zooming in too far. "

Im not sure if this is true, if one will raise the frequenzy of palette

i think the detail depth will probably increase to infinity - so it probably depends how you  define this construct

Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

PARTNERS