Logo by yv3 - Contribute your own Logo!

END OF AN ERA, FRACTALFORUMS.COM IS CONTINUED ON FRACTALFORUMS.ORG

it was a great time but no longer maintainable by c.Kleinhuis contact him for any data retrieval,
thanks and see you perhaps in 10 years again

this forum will stay online for reference
News: Support us via Flattr FLATTR Link
 
*
Welcome, Guest. Please login or register. March 29, 2024, 02:56:37 PM


Login with username, password and session length


The All New FractalForums is now in Public Beta Testing! Visit FractalForums.org and check it out!


Pages: [1]   Go Down
  Print  
Share this topic on DiggShare this topic on FacebookShare this topic on GoogleShare this topic on RedditShare this topic on StumbleUponShare this topic on Twitter
Author Topic: Can anyone help me understand interior distance estimation?  (Read 1040 times)
0 Members and 2 Guests are viewing this topic.
laser blaster
Iterator
*
Posts: 178


« on: April 04, 2013, 09:52:33 PM »

Hey. So, I've been trying to implement interior distance estimation into my fractal explorer, but I haven't been able to find a clear explanation on the interior DE algorithm.

Wikipedia has the formula on the Mandelbrot Set page, but the fancy notation used is completely indecipherable to me (I'm not a math expert, just a programmer).


The only code I've been able to find is here: http://www.moleculardensity.net/buddhabrot/appendix/2
Unfortunately, that code is so bloated and convoluted that I can't make any sense of it. It doesn't use many abstractions like vectors or functions, it's all written in terms of simple math operations on doubles. I just can't understand what it's doing.

Could someone with experience give me a simpler description of the interior DE algorithm? Thank you very much.
Logged
Syntopia
Fractal Molossus
**
Posts: 681



syntopiadk
WWW
« Reply #1 on: April 04, 2013, 10:31:30 PM »

The interior distance estimate is quite complicated, but I actually think the link you provide gives quite a good description - formulas are shown both in component and complex notation.

If you have implemented the exterior estimate, some of the terms should be familiar. The biggest difference is that for interior estimate you have to keep track of four different running derivatives, instead of only one. In the code the four running derivaties are the D1,D2,D3,D4 variables.

You also have to find the periodic cycle, which may prove difficult if you are working in GLSL - I'm not sure you can allocate large enough float buffers.

Do you need the estimate? I don't think it will help you much with your AA issues, since there is no true link between the coverage and the distance estimate anyway.
Logged
laser blaster
Iterator
*
Posts: 178


« Reply #2 on: April 04, 2013, 11:43:54 PM »

Thank you for such a fast and thorough reply! smiley

Hmm... I guess that code isn't really that difficult to understand. I was just intimidated by the bulk of it. The comments do explain what's going on in complex notation. I now understand that Z is the iterated point, and D1-D4 are the 4 derivatives mentioned on Wikipedia. The periodic cycle code is not as hard as I first thought, now that I realize it just returns a list of the points in the cycle that Z converges to.

But you're right, the periodic cycle code will be impractical to implement in glsl because it requires arbitrarily large buffers to store the points in the cycle. I'd say it's not very well-suited to GPU computing in general.

I don't exactly need the estimate, I was trying to use it to replace supersampling for AA (which can look decent, you just need to manually adjust a distance multiplier for every picture you take). But due to the potentially huge arrays required by the interior DE algorithm, I'm thinking it would be even more of a performance hog than SSAA.

Yeah, I guess I'll just have to stick with SSAA.
Logged
therror
Explorer
****
Posts: 42


« Reply #3 on: September 07, 2016, 09:32:24 AM »

Hello! Does anyone know if I can try it for the Multibrot set (with arbitrary non-integer powers)? I have implemented period detection for Multibrot and I want to add interior distance estimation for more complex coloring.
Logged
Adam Majewski
Fractal Lover
**
Posts: 221


WWW
« Reply #4 on: September 07, 2016, 06:41:32 PM »

https://en.wikibooks.org/wiki/Fractals/Iterations_in_the_complex_plane/demm#Interior_distance_estimation
hth
Logged
therror
Explorer
****
Posts: 42


« Reply #5 on: September 27, 2016, 11:42:28 AM »

Thank you very much, Adam! I have implemented Multibrot interior distance estimation! I think it is not fully correct. Maybe, period is computed with error.


* name10949.jpg (121.04 KB, 1280x960 - viewed 75 times.)
Logged
therror
Explorer
****
Posts: 42


« Reply #6 on: October 25, 2016, 03:15:33 PM »

I fixed multiple errors, but unfortunately my formulae are wrong sad At power=2 all wright, but at higher powers (in this picture 7.97) only period=1 bulb (i.e. main part) shows correct distance estimation. Can anyone help me to find error?
Code:
  FLOAT zp, zq, dzp= ONE , dzq=0, dcp=0, dcq=0, dzdzp=0, dzdzq=0, dcdzp=0, dcdzq=0, dzpt, dzqt, dcpt, dcqt, dzdzpt, dcdzpt, x, y, cosat, sinat, x2y2=0, po, at, at2, sp, sq, xcompare, ycompare;\
....
  if (mindist<toler) mintest=2;\
  for (count=1; count<mintest; count++)\
  {\
    if (x2y2>8)\
    {\
      count=0;\
      break;\
    }\
    x2y2=x*x+y*y;\
    at2= ATAN2 (y, x);\
    po= POW (x2y2, HALF *powm);\
    at=powm*at2;\
    SINCOS (at, &sinat, &cosat);\
    x=po*cosat+sp;\
    y=po*sinat+sq;\
    po= POW (x2y2, HALF *(powm - ONE ));\
    at-=at2;\
    SINCOS (at, &sinat, &cosat);\
    zp=po*cosat;\
    zq=po*sinat;\
    dzpt=powm*(zp*dzp-zq*dzq);\
    dzqt=powm*(zq*dzp+zp*dzq);\
    dcpt=powm*(zp*dcp-zq*dcq)+ ONE ;\
    dcqt=powm*(zq*dcp+zp*dcq);\
    dzdzpt=powm*((zp*dzdzp-zq*dzdzq)+(dzp*dzp-dzq*dzq));\
    dzdzq =powm*((zp*dzdzq+zq*dzdzp)+(2*dzp*dzq));\
    dcdzpt=powm*((zp*dcdzp-zq*dcdzq)+(dzp*dcp-dzq*dcq));\
    dcdzq =powm*((zp*dcdzq+zq*dcdzp)+(dzp*dcq+dcp*dzq));\
    dzp=dzpt;\
    dzq=dzqt;\
    dcp=dcpt;\
    dcq=dcqt;\
    dzdzp=dzdzpt;\
    dcdzp=dcdzpt;\
    if ((xcompare-x)*(xcompare-x)+(ycompare-y)*(ycompare-y)<mindist) break;\
  }\


* name10949.jpg (59.37 KB, 640x480 - viewed 68 times.)

* name00003.jpg (47.03 KB, 640x480 - viewed 77 times.)
Logged
therror
Explorer
****
Posts: 42


« Reply #7 on: October 29, 2016, 06:28:19 AM »

Wrong second derivatives. Fixed.
Code:
for (count=1; count<mintest; count++)\
  {\
    if (x2y2>8)\
    {\
      count=0;\
      break;\
    }\
    x2y2=x*x+y*y;\
    at2= ATAN2 (y, x);\
    po= POW (x2y2, HALF *powm);\
    at=powm*at2;\
    SINCOS (at, &sinat, &cosat);\
    x=po*cosat+sp;\
    y=po*sinat+sq;\
    po= POW (x2y2, HALF *(powm - ONE ));\
    at-=at2;\
    SINCOS (at, &sinat, &cosat);\
    zp_1=po*cosat;\
    zq_1=po*sinat;\
    po= POW (x2y2, HALF *(powm - ONE - ONE ));\
    at-=at2;\
    SINCOS (at, &sinat, &cosat);\
    zp_2=po*cosat;\
    zq_2=po*sinat;\
    dzpt=powm*(zp_1*dzp-zq_1*dzq);\
    dzqt=powm*(zq_1*dzp+zp_1*dzq);\
    dcpt=powm*(zp_1*dcp-zq_1*dcq)+ ONE ;\
    dcqt=powm*(zq_1*dcp+zp_1*dcq);\
    dzp2=dzp*dzp-dzq*dzq;\
    dzq2=2*dzp*dzq;\
    dzdzpt=powm*((zp_1*dzdzp-zq_1*dzdzq)+(powm- ONE )*(zp_2*dzp2-zq_2*dzq2));\
    dzdzq =powm*((zp_1*dzdzq+zq_1*dzdzp)+(powm- ONE )*(zp_2*dzq2+zq_2*dzp2));\
    dzp2=dzp*dcp-dzq*dcq;\
    dzq2=dzp*dcq+dcp*dzq;\
    dcdzpt=powm*((zp_1*dcdzp-zq_1*dcdzq)+(powm- ONE )*(zp_2*dzp2-zq_2*dzq2));\
    dcdzq =powm*((zp_1*dcdzq+zq_1*dcdzp)+(powm- ONE )*(zp_2*dzq2+zq_2*dzp2));\
    dzp=dzpt;\
    dzq=dzqt;\
    dcp=dcpt;\
    dcq=dcqt;\
    dzdzp=dzdzpt;\
    dcdzp=dcdzpt;\
    if ((xcompare-x)*(xcompare-x)+(ycompare-y)*(ycompare-y)<mindist) break;\
  }\


* name00004.jpg (57.63 KB, 640x480 - viewed 70 times.)

* name00003.jpg (53.27 KB, 640x480 - viewed 81 times.)
Logged
Pages: [1]   Go Down
  Print  
 
Jump to:  

Related Topics
Subject Started by Replies Views Last post
Convergent Distance Estimation Programming David Makin 9 7926 Last post November 28, 2008, 10:27:01 PM
by gamma
Convergent Distance Estimation Mathematics David Makin 4 11158 Last post April 08, 2009, 10:07:14 PM
by David Makin
Pseudo Distance Estimation Mandelbulb Implementation JColyer 3 4829 Last post January 09, 2010, 03:30:09 PM
by JColyer
Practical interior distance rendering Mandelbrot & Julia Set claude 0 2276 Last post November 02, 2014, 04:18:58 PM
by claude
Perpendicular Multibrot with Interior distance estimation Movies Showcase (Rate My Movie) therror 1 1939 Last post November 26, 2016, 03:05:16 AM
by greentexas

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines

Valid XHTML 1.0! Valid CSS! Dilber MC Theme by HarzeM
Page created in 0.26 seconds with 24 queries. (Pretty URLs adds 0.014s, 2q)