POV-Ray : Newsgroups : povray.binaries.images : Fractal weirdness Server Time
12 Nov 2024 14:40:39 EST (-0500)
  Fractal weirdness (Message 1 to 3 of 3)  
From: Anthony D  Baye
Subject: Fractal weirdness
Date: 19 Jun 2011 14:10:01
Message: <web.4dfe3ab2dc4f47629c4fb0ad0@news.povray.org>
I've been toying around with fractals again.  My latest investigation is the
Gosper Island.  I had been thinking of using the fractal as a tile, but I'm
having trouble locating the center.

I'm using my logo macros to generate the fractal.  The file is included below.

#macro triline2(len, epsilon)

#if(len < epsilon)
    fd(len)
#else
    lt(acos(5 * sqrt(7) / 14))
    triline2(len/sqrt(7), epsilon)
    rt(60)
    triline2(len/sqrt(7), epsilon)
    lt(60)
    triline2(len/sqrt(7), epsilon)
    rt(acos(5 * sqrt(7) / 14))
#end

#end

// Gosper fractal can tile the plane
#macro Gosper(len, epsilon)

#local a = 0;
#while(a < 6)
    triline2(len, epsilon)
    lt(60)
#local a = a + 1;
#end

#end

init()
Gosper(2, 0.01)

The problem is that as epsilon gets smaller, the fractal seems to rotate about
the origin, and I'm not sure why.  I don't have the time to dig through the
calculations, but I suspect that it has to do with where the recursion stops.

If anyone can help, I'd appreciate it.

Regards,

A.D.B.

P.S: as a side note, it might be neat to have some of these fractals like the
Koch flake and the Gosper island available as patterns in a later version...

/* ! ----- Begin koch.pov ----- ! */
#include "kolors.inc"
#include "math.inc"

light_source { -50.0*z, color rgb 1 }
camera {
     orthographic
     location <0.0, 0.0, -10.0>
     look_at 0.0
     }

#macro init()
#declare _cP_ = <0.0, 0.0, 0.0>;
#declare _cD_ = 0;
#declare _DRAW_ = true;
#declare _INIT_ = 1;
#end

// Pen Up
#macro pu()
     #declare _DRAW_ = false;
#end

// Pen Down
#macro pd()
     #declare _DRAW_ = true;
#end

// left turn (degrees)
#macro lt(d)
#ifdef(_INIT_)
     #declare _cD_ = _cD_ + d;
     #if(_cD_ > 360)
          #declare _cD_ = _cD_ - 360;
     #end
#end
#end

// right turn (degrees)
#macro rt(d)
#ifdef(_INIT_)
     #declare _cD_ = _cD_ - d;
     #if(_cD_ < -360)
          #declare _cD_ = _cD_ + 360;
     #end
#end
#end

// foreward (length)
#macro fd(l)
#ifdef(_INIT_)
     #local _pL_ = _cP_;
     #declare _cP_ = _cP_ + l*<cosd(_cD_), sind(_cD_), 0>;

     #if(_DRAW_)
          cylinder { _pL_, _cP_, 0.015625 pigment {Orange}
               finish { ambient 0.6 diffuse 0.3 } }
     #end
#end
#end

#macro home()



#debug concat("_cD_ = " str(_cD_,6,6) "\n")
#debug concat("_cP_ = <" str(_cP_.x,6,6) ", " str(_cP_.y,6,6) ", "
     str(_cP_.z,6,6)">\n")
#local rV = <0,0,0> - _cP_;
#local mag_rV = sqrt(pow(rV.x,2) + pow(rV.y,2));
#local rV = rV / mag_rV;
#debug concat("rV = <" str(rV.x,6,6) ", " str(rV.y,6,6) ", "
     str(rV.z,6,6)">\n")

#local cV = _cP_ + <cosd(_cD_),sind(_cD_),0>;
#local cV = cV / sqrt(pow(cV.x,2) + pow(cV.y,2));
#debug concat("cV = <" str(cV.x,6,6) ", " str(cV.y,6,6) ", "
     str(cV.z,6,6)">\n")

#local theta = degrees(acos(vdot(rV,cV)));
#debug concat(str(theta,6,6) "\n")
#debug concat(str(mag_rV,6,6) "\n")

#local hV = <0,0,0>;
/*
lt(theta)
fd(mag_rV)
lt(acos(vdot(rV,hV)))
*/
#end

#macro triline(len)

#if(len < 0.01)
     fd(len)
#else
     triline(len/3)
     lt(60)
     triline(len/3)
     rt(120)
     triline(len/3)
     lt(60)
     triline(len/3)
#end

#end

#macro triline2(len, epsilon)

#if(len < epsilon)
     fd(len)
#else
     lt(acos(5 * sqrt(7) / 14))
     triline2(len/sqrt(7), epsilon)
     rt(60)
     triline2(len/sqrt(7), epsilon)
     lt(60)
     triline2(len/sqrt(7), epsilon)
     rt(acos(5 * sqrt(7) / 14))
#end

#end

#macro koch(len)

pu()
lt(90)
fd(len*sind(30) - (len/3)*sind(30))
lt(90)
fd(len/2)
rt(180)
pd()
     #local a = 0;
     #while(a < 3)
          triline(len)
          rt(120)
     #local a = a + 1;
     #end
home()
#end

#macro gosper(len, epsilon)

     #local a = 0;
     #while(a < 6)
          triline2(len, epsilon)
          lt(60)
     #local a = a + 1;
     #end
#end

sphere { 0.0, 0.1 pigment { rgb 1 } }
init()
/*
pu()
lt(180)
fd(1.25)
rt(90)
fd(3.5)
rt(90)
pd()
*/
//triline2(2, 1)
gosper(2, 2/pow(sqrt(7),7))

//rt(30)
//fd(2)


Post a reply to this message


Attachments:
Download 'koch.png' (21 KB)

Preview of image 'koch.png'
koch.png


 

From: Le Forgeron
Subject: Re: Fractal weirdness
Date: 20 Jun 2011 05:06:43
Message: <4dff0da3$1@news.povray.org>
Le 19/06/2011 20:08, Anthony D. Baye a écrit :
> P.S: as a side note, it might be neat to have some of these fractals like the
> Koch flake and the Gosper island available as patterns in a later version...
> 
Have you a complete list (of name(s) & function(s)) ?

would you expect a "one time pattern" (like cylindrical) or a repeating
one (like quilted) ? would using "warp repeat" by sufficent ?


-- 
Software is like dirt - it costs time and money to change it and move it
around.

Just because you can't see it, it doesn't weigh anything,
and you can't drill a hole in it and stick a rivet into it doesn't mean
it's free.


Post a reply to this message

From: Anthony D  Baye
Subject: Re: Fractal weirdness
Date: 20 Jun 2011 09:45:00
Message: <web.4dff4e3d1e7ee36ce5496b350@news.povray.org>
Le_Forgeron <lef### [at] freefr> wrote:
> Le 19/06/2011 20:08, Anthony D. Baye a écrit :
> > P.S: as a side note, it might be neat to have some of these fractals like the
> > Koch flake and the Gosper island available as patterns in a later version...
> >
> Have you a complete list (of name(s) & function(s)) ?
>
> would you expect a "one time pattern" (like cylindrical) or a repeating
> one (like quilted) ? would using "warp repeat" by sufficent ?
>
>
> --
> Software is like dirt - it costs time and money to change it and move it
> around.
>
> Just because you can't see it, it doesn't weigh anything,
> and you can't drill a hole in it and stick a rivet into it doesn't mean
> it's free.

I was thinking of just the ones that tile the plane, like the Gosper island.
The Koch flake can also tile, but it uses a couple of different sizes, so I'm
not sure how feasible it is.  As for other fractals, I haven't really explored
many of them, so it was more a random thought.

I was simply thinking that some of them would make good patterns.

Regards,

A.D.B.


Post a reply to this message

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