XaoS icon indicating copy to clipboard operation
XaoS copied to clipboard

Y axis is inverted from proper mathematical conventions

Open jblang opened this issue 10 years ago • 2 comments

From [email protected] on May 03, 2009 23:03:39

The julia set is flipped horizontally versus the correct orientation. Try the set c = .123 + .745i and compare it to the image here: http://mathworld.wolfram.com/JuliaSet.html .

This is not peculiar to any platform or processor architecture. I was able to reproduce it on Ubuntu 7.10 on i386 as well as Mac OS X on PPC. Reference the following image: http://mathworld.wolfram.com/DouadysRabbitFractal.html

Original issue: http://code.google.com/p/gnuxaos/issues/detail?id=6

jblang avatar Nov 02 '13 18:11 jblang

I have confirmed this behavior on master. I suspect, however, that the problem is actually that the sets are flipped vertically, not horizontally, and that it happens with all fractals, not just Julias. The effect of flipping vertically would look the same as flipping horizontally for Julia-type fractals, but would not be apparent on Mandelbrot-type fractals, because almost all Mandelbrot-type fractals are vertically symmetrical. Otherwise, it's hard to understand how this could only affect Julias since they are calculated by the same function that calculates Mandelbrots, only with c and z parameters swapped here and here. The problem with Julias can be fixed by changing y to -y on those two lines.

This bug also affects Julia preview mode, and the above fix does not help there, because Julia previews are calculated here, in a completely separate code path. In this case, I believe we need to change this line to

y = (int) ((IMAX - zim) * ydelta);

However, I suspect neither of these changes are the correct way to fix this. Instead we need to figure out where the y coordinates are flipped in the first place (maybe in boundary trace?).

jblang avatar Apr 16 '19 13:04 jblang

@dpthurst Pointed out on #132:

Wouldn't the issue be that coordinates are never flipped? By default, screen coordinates in most frameworks have the positive x-axis pointing to the right, and the positive y-axis pointing down. This is the opposite of the usual mathematical conventions.

I believe that this is correct. It should be a simple change to flip the y axis in the function that converts from pixel coordinates to complex coordinates and vice versa.

However, I need to be sure this won't break the position files that people saved before this change.

jblang avatar Feb 01 '20 16:02 jblang