POV-Ray : Newsgroups : povray.advanced-users : Pappus Chain Server Time
27 Jul 2024 18:42:42 EDT (-0400)
  Pappus Chain (Message 24 to 33 of 43)  
<<< Previous 10 Messages Goto Latest 10 Messages Next 10 Messages >>>
From: MichaelJF
Subject: Re: Pappus Chain
Date: 17 Jun 2024 15:53:19
Message: <6670942f@news.povray.org>
Am 16.06.2024 um 13:44 schrieb Bald Eagle:
> Ugh.
> 
> I tried rewriting from scratch (porting the Javascript code from
> https://en.wikibooks.org/wiki/Fractals/Apollonian_fractals to SDL)
> and I'm still stuck with that upper left hand portion not being right.
> 
> I thought maybe some of the quadratic solution checking in that could would fix
> things, because saving that code as an SVG file and opening it in a browser
> works beautifully (and it's FAST!).
> 
> So, still sitting here with my dunce cap on until I figure out how to wrap my
> head around what's going wrong with the center coordinates and the recursion
> queue.
> 
> - BW
> 
It took me a while to understand this weird javascript recursion and I 
mixed up some - with + or vice versa:

global_settings {assumed_gamma 1.0 }

#include "colors.inc"

#declare S3 = sqrt(3);

#declare M = 3;
#declare C1 = < 1,  0,  1>+M*(x+y);
#declare C2 = <-1,  0,  1>+M*(x+y);
#declare C3 = < 0, S3,  1>+M*(x+y);


camera {
  location M*<0,0,-2.25>//M*<1, S3/2, -2.25>
  right x*image_width/image_height
  up y
  look_at <0,0,0>//M*<1, S3/2, 0>
  //rotate y*15
}
sky_sphere {pigment {rgb 1}}
light_source {< 0, 0, -150> rgb 1}

#declare Line = 0.005;

cylinder {-x*100, x*100, Line pigment {rgb x}}
cylinder {-y*100, y*100, Line pigment {rgb y}}

#declare k4curvature1 = function (k1, k2, k3) {k1 + k2 + k3 + 2 * sqrt 
(k1*k2 +
k2*k3 + k3*k1)}
#declare k4curvature2 = function (k1, k2, k3) {k1 + k2 + k3 - 2 * sqrt 
(k1*k2 +
k2*k3 + k3*k1)}

#macro Re(Z) Z.x #end
#macro Im(Z) Z.y #end
#macro Cmul(z1, z2)
    <Re(z1)*Re(z2) - Im(z1)*Im(z2), Re(z1)*Im(z2) + Im(z1)*Re(z2)>
#end
#macro Cadd(a,b)
    <Re(a)+Re(b),Im(a)+Im(b)>
#end
#macro Csub(a,b)
    <Re(a)-Re(b),Im(a)-Im(b)>
#end

#macro Csqrt (Z)
  #local m = sqrt ( Re(Z)*Re(Z) + Im(Z)*Im(Z) );
  #local Angle = atan2 (Im(Z), Re(Z)) / 2;
  #local NewZ = sqrt(m)*<cos(Angle), sin(Angle)>;
  NewZ
#end
/*#macro Csqrt(Z)
    #local m = sqrt ( Re(Z)*Re(Z) + Im(Z)*Im(Z) );
    <sqrt((m+Re(Z))/2),abs(Im(Z))/Im(Z)*sqrt((m-Re(Z))/2)>
#end*/


#declare Colours=array[7]{Violet,Blue,Cyan,Green,Yellow,Orange,Red}

#macro DrawCircle (C,PigmNr)
    torus {abs(C.z), Line pigment {colour Colours[PigmNr]} rotate x*90 
translate <C.x, C.y, 0>}
#end


/***********************************************
Edit the seed for other circles or run an animation
#declare Zufall=seed(36730+frame_number);
************************************************/

#declare Zufall=seed(36730+17);

// unit circle
#declare b=<0,0,-1>;

// insert two raqndomly positioned touching circles
#declare tr = 1-rand(Zufall)/2;
#declare pa = pi/2 - asin(rand(Zufall)*(1-tr)/tr);
#declare px = tr * cos(pa);
#declare py = tr * sin(pa);
#declare pr = 1 - tr;
#declare qr = (1 - pr) * (1 - cos(pa + pi/2))  / (1 + pr - (1 - pr) 
*cos(pa + pi/2));
#declare qx = 0;
#declare qy = qr - 1;

#declare p=<px,py,pr>;
#declare q=<qx,qy,qr>;

#declare MinRadius=0.1;

#declare MaxDepth=7;

#macro Kiss(a,b,c,initial,Depth)
    #if (Depth <= MaxDepth)
       #local k1 = 1/a.z; // real
       #local z1 = <a.x,a.y>; // complex
       #local kz1 = Cmul(<k1,0>,z1); // complex

       #local k2 = 1/b.z; // real
       #local z2 = <b.x,b.y>; // complex
       #local kz2 = Cmul(<k2,0>,z2); // complex

       #local k3 = 1/c.z; // real
       #local z3 = <c.x,c.y>; // complex
       #local kz3 = Cmul(<k3,0>,z3); // complex

       #local k4p = k1 + k2 + k3 + 2*sqrt(k1*k2 + k2*k3 + k3*k1); // real
       #local k4m = k1 + k2 + k3 - 2*sqrt(k1*k2 + k2*k3 + k3*k1); // real

       #local kz4p = 
Cadd(Cadd(Cadd(kz1,kz2),kz3),Cmul(<2,0>,Csqrt(Cadd(Cadd(Cmul(kz1,kz2),Cmul(kz2,kz3)),Cmul(kz3,kz1)))));

// complex
       #local kz4m = 
Csub(Cadd(Cadd(kz1,kz2),kz3),Cmul(<2,0>,Csqrt(Cadd(Cadd(Cmul(kz1,kz2),Cmul(kz2,kz3)),Cmul(kz3,kz1)))));

// complex

       #if (k4p > k4m)
          #local k4 = k4p; // real
          #local kz4 = kz4p; // complex
          #local k4b = k4m; // real
          #local kz4b = kz4m; // complex
       #else
          #local k4 = k4m; // real
          #local kz4 = kz4m; // complex
          #local k4b = k4p; // real
          #local kz4b = kz4p; // complex
       #end

       #local cc = <kz4.x/k4 , kz4.y/k4 , abs(1/k4)>; // Circle

       #local dx = a.x - cc.x;
       #local dy = a.y - cc.y;
       #local dr = a.z + cc.z;

       #local dtest=abs(dx*dx + dy*dy - dr*dr);

       #if ( abs(dx*dx + dy*dy - dr*dr) > 0.0001 )
          #local cc = <kz4b.x/k4 , kz4b.y/k4 , abs(1/k4)>;
       #end

       #if (initial)
          #local cc=<kz4b.x/k4b,kz4b.y/k4b,abs(1/k4b)>;
       #end

       DrawCircle(cc,mod(Depth,7))

       Kiss(a,b,cc,false,Depth+1)
       Kiss(a,cc,c,false,Depth+1)
       Kiss(cc,b,c,false,Depth+1)
    #end
#end


DrawCircle(b,0)
DrawCircle(p,0)
DrawCircle(q,0)


Kiss(b,p,q,true,1)
Kiss(b,p,q,false,1)


Post a reply to this message


Attachments:
Download 'apollonian_fractals_03.png' (68 KB)

Preview of image 'apollonian_fractals_03.png'
apollonian_fractals_03.png


 

From: Bald Eagle
Subject: Re: Pappus Chain
Date: 17 Jun 2024 17:50:00
Message: <web.6670af7f3bd24dfe1f9dae3025979125@news.povray.org>
MichaelJF <fri### [at] t-onlinede> wrote:

> It took me a while to understand this weird javascript recursion and I
> mixed up some - with + or vice versa:

Excellent!
Now that there's some working SDL, I can try to understand where things went off
the rails, and try to make some variations.

Maybe a nested Appolonian gasket, but also one with circles in between 2
straight lines (circles with infinite radius, curvature of zero, resulting in
"Ford circles)

Thanks so much, Michael!

- BW


Post a reply to this message

From: Bald Eagle
Subject: Re: Pappus Chain
Date: 17 Jun 2024 18:35:00
Message: <web.6670b9c03bd24dfe1f9dae3025979125@news.povray.org>
But for now...


Post a reply to this message


Attachments:
Download 'mjf_appolloniancylinders.png' (119 KB)

Preview of image 'mjf_appolloniancylinders.png'
mjf_appolloniancylinders.png


 

From: Bald Eagle
Subject: Re: Pappus Chain
Date: 17 Jun 2024 18:35:00
Message: <web.6670b9d73bd24dfe1f9dae3025979125@news.povray.org>
And


#macro DrawCircle (C, PigmNr)

 //#debug concat( "C = ", vstr(3, C, ", ", 0, 3), " \n")
 //torus {abs(C.z), Line texture {pigment {colour Colours[PigmNr]} finish
{emission 1}} rotate x*90 translate <C.x, C.y, 0>}
 #if (C.z > 0 & C.z < 0.6)
 sphere {0, abs(C.z) scale <1, 1, 1+pow(abs(C.z), 0.001)> texture {pigment
{colour Colours[PigmNr]} finish {specular 0.4}} translate <C.x, C.y, 0>}
 #end
#end


Post a reply to this message


Attachments:
Download 'mjf_appollonianellipsoids.png' (133 KB)

Preview of image 'mjf_appollonianellipsoids.png'
mjf_appollonianellipsoids.png


 

From: Bald Eagle
Subject: Re: Pappus Chain
Date: 17 Jun 2024 18:55:00
Message: <web.6670bdb23bd24dfe1f9dae3025979125@news.povray.org>
And of course, because the Appollonian gasket is a foam, . . .

bubbles!


Post a reply to this message


Attachments:
Download 'mjf_appollonianbubbles.png' (608 KB)

Preview of image 'mjf_appollonianbubbles.png'
mjf_appollonianbubbles.png


 

From: Bald Eagle
Subject: Re: Pappus Chain
Date: 17 Jun 2024 20:05:00
Message: <web.6670ce7d3bd24dfe1f9dae3025979125@news.povray.org>
and with a nested gasket, we could do a sort of Sierpinski triangle.

There's some kind of transformation that makes them isomorphic.


Post a reply to this message


Attachments:
Download 'mjf_appolloniantriangles.png' (64 KB)

Preview of image 'mjf_appolloniantriangles.png'
mjf_appolloniantriangles.png


 

From: kurtz le pirate
Subject: Re: Pappus Chain
Date: 18 Jun 2024 11:28:16
Message: <6671a790$1@news.povray.org>
On 17/06/2024 23:49, Bald Eagle wrote:
> Excellent!
> Now that there's some working SDL, I can try to understand where things went off
> the rails, and try to make some variations.


I've updated my page and published the code (at the very bottom).
<http://louisbel.free.fr/scenes/scene038.shtml>


Sorry, still in French
-- 
Kurtz le pirate
Compagnie de la Banquise


Post a reply to this message

From: kurtz le pirate
Subject: Re: Pappus Chain
Date: 18 Jun 2024 11:29:05
Message: <6671a7c1$1@news.povray.org>
On 18/06/2024 00:50, Bald Eagle wrote:
> And of course, because the Appollonian gasket is a foam, . . .
> 
> bubbles!
> 


GREAT Bubbles. Very good job.


-- 
Kurtz le pirate
Compagnie de la Banquise


Post a reply to this message

From: Bald Eagle
Subject: Re: Pappus Chain
Date: 18 Jun 2024 16:05:00
Message: <web.6671e8453bd24dfec74cee8225979125@news.povray.org>
Just posting this here for reference.

https://www.johndcook.com/blog/2023/12/19/conformal-map-disk-triangle/

Would be cool to apply this to the gasket to see what pops out - probably a
Sierpinski Triangle.

Search: conformal mapping of circle to a triangle

- BE


Post a reply to this message

From: Bald Eagle
Subject: Re: Pappus Chain
Date: 18 Jun 2024 20:40:00
Message: <web.667228173bd24dfe1f9dae3025979125@news.povray.org>
Now with lenses!


Post a reply to this message


Attachments:
Download 'mjf_appollonianlenses.png' (451 KB)

Preview of image 'mjf_appollonianlenses.png'
mjf_appollonianlenses.png


 

<<< Previous 10 Messages Goto Latest 10 Messages Next 10 Messages >>>

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.