Circle Tree

  • 3 Replies
  • 178 Views

0 Members and 1 Guest are viewing this topic.

Offline C0ryMcG

  • *
  • Uploader
  • *
  • Posts: 215
« on: July 24, 2020, 06:07:08 AM »
It works!
This is a branch, so to speak, from the Sphere Tree discussion over at https://fractalforums.org/fractal-mathematics-and-new-theories/28/new-sphere-tree/3557
I considered replying there, but since what I'm doing is distinctly different, (a different number of dimensions used in the math) it seemed like posting there would be off-topic.

Anyway, here is a circle tree! It's a self-similar fractal built out of tangentially touching circles. I tried before to make this in the Sphere Tree thread by rendering only a slice of the 3d shape that the others were talking about and I got some beautiful, but strange and not-quite-accurate results.
I spent the past few days examining the math and doing some extra research and finally got to the point where I understood most of what the code was doing. Then I built the system for 2d and hit the Render button.

My results are similar to the sphere tree results, except the sphere version seems to have Ford Circle packing, so maybe there's a bit more for me to figure out.

This is the code I used (javascript)
Code: [Select]
iteratePoints = function(p){
         var results = [];
//diameter of the whole circle is 1.
        var majorRadius = 0.5;
var minorRadius = 0.3;
var miniRadius = majorRadius - minorRadius;
//the radius for a circle inversion that will preserve the first circle in the circle chain is sqrt(2minorRadius)

//we can imagine the structure of this as a Pappus Chain
for(var i = 0; i < userSettings.iterations; i++){
//circle invert the point
p = circleInvert(p.x, p.y, {radius: Math.sqrt(2*minorRadius)});
//now the system is theoretically a horizontal strip of equal circles to infinity
//modulo horizontally to result in a single circle right in the middle
p.x = realMod(p.x, (2*miniRadius));
if (p.x > miniRadius) p.x-= 2*miniRadius;

//back to normal
p = circleInvert(p.x, p.y, {radius: Math.sqrt(2*minorRadius)});

//only do this if the point is not already in the main circle's trap
if (vDist(p, {x: 0, y: 0-minorRadius})>minorRadius){
//stretch the mini circle to the size and position of the whole diameter 1 circle
p.y = p.y + minorRadius + majorRadius;
p.x *= majorRadius / miniRadius;
p.y *= majorRadius / miniRadius;
p.y = p.y - majorRadius;
}
results.push({r: p.x, i: p.y});
}
        return results;
}


The image uses a figure-8 shaped orbit trap for coloring. (only half of which has any effect, since the bottom of the circle is point 0,0, which is where the X of the figure-8 is)

Linkback: https://fractalforums.org/share-a-fractal/22/circle-tree/3679/

Offline Adam Majewski

  • *
  • Fractal Flamingo
  • ****
  • Posts: 346

Offline C0ryMcG

  • *
  • Uploader
  • *
  • Posts: 215
« Reply #2 on: July 29, 2020, 06:55:07 AM »
Progress! I got the Ford Circles working. took an extra if statement, and some mental acrobats to figure out what values need to be used during the first inversion used...
It's not perfect, you can see the tip of the mini circles on the 'shoulders' has an extra half-circle, not sure why, but it's starting to look like what I was hoping it would look like!

Colored with Golf Coloring, as I just learned it's called, discussed originally here: https://fractalforums.org/fractal-mathematics-and-new-theories/28/smooth-1d-coloring/2753


Offline C0ryMcG

  • *
  • Uploader
  • *
  • Posts: 215
« Reply #3 on: July 29, 2020, 06:57:21 AM »
Oh, and the added code is as follows. It fits in nicely just before the second circleInvert, or, in other words, it's the last function performed before the image is un-inverted. That's where the mental gymnastics came in.

Code: [Select]
var counter = 0;
//check to see if the point is now potentially in a Ford Circle
while (counter < userSettings.iterations && p.y < majorRadius*2 && p.y > majorRadius*2 - miniRadius && vDist(p, {x: 0, y: minorRadius*2 + miniRadius})>miniRadius){
p = circleInvert(p.x, p.y, {radius: miniRadius, offset: {x: 0, y: majorRadius*2}});
p.x = realMod(p.x, miniRadius*0.5)+miniRadius;
if (p.x > miniRadius*1.25) p.x-= miniRadius*0.5;

p = circleInvert(p.x, p.y, {radius: miniRadius, offset: {x: 0, y: majorRadius*2}});

p.x-=miniRadius;
p.y-=majorRadius*2;
p.x*=4;
p.y*=4;
p.y+=majorRadius*2;
}


xx
"Cambridge Circle"

Started by cricke49 on Fractal Image Gallery

0 Replies
110 Views
Last post April 08, 2018, 06:19:24 AM
by cricke49
xx
Ghosts Tree

Started by utak3r on Fractal Image Gallery

0 Replies
131 Views
Last post March 09, 2018, 10:02:16 PM
by utak3r
xx
Snail Tree

Started by AlexH on Fractal Image Gallery

1 Replies
134 Views
Last post October 07, 2018, 01:37:11 AM
by AlexH
xx
Wrapped Tree

Started by AlexH on Fractal Image Gallery

1 Replies
158 Views
Last post October 07, 2018, 05:30:57 AM
by AlexH
clip
New sphere tree

Started by TGlad on Fractal Mathematics And New Theories

111 Replies
1964 Views
Last post July 27, 2020, 12:04:41 AM
by Alef