|
|
Spider wrote:
> interesting images, what was the formulae, again?
> (*hint*)
Unfortunatly, I'm not all that clear on the formula, myself, I just thought it looked
interesting.. ;>
Originally, I wrote the code to export the points in Turbo Pascal, but here's the POV
translation of it; make sense of it what you will. I'm not posting this as a real
macro, though, as it would take way too long to get any number of points. POV just
doesn't like the serious number crunching.. As soon as I can throw one together, I'll
post a .. *gasp* .. 2d .. image of the dragon curve, which will probably make it more
clear why it's called that.. Hrm. Actually, as posting of 2d images is unlawful
around
here, I just may have to TGAmosaic it.. *g*
-Alex
---- Code follows ----
-- Oooh! Indention! --
#declare detail = 400; // Lower numbers make more blobs..
#declare Qval = 0.97064; // Main parameter to change to get different shapes.
// Note that Qval=0 doesn't work.. this is actually the
// imaginary part of a complex number; P is the real
// part.
#declare R = seed(42);
blob {
#declare k = 3;
#while (k >= -3)
#debug concat(str(k,5,5),"\n")
#declare tx = 0.50001;
#declare ty = 0;
#declare magnitude = (k*k + Qval*Qval);
#declare Q = (-4*Qval/magnitude);
#declare P = (4*k/magnitude);
#declare i = 1;
#while (i <= 12000) // Iteration part. Each iteration is more accurate.
#declare temp_x = (tx*P - ty*Q);
#declare ty = (tx*Q + ty*P);
#declare temp_y = ty;
#declare tx = (1- temp_x);
#declare magnitude = sqrt(tx*tx + ty*ty);
#declare ty = sqrt((-tx+magnitude)/2);
#declare tx = sqrt((tx+magnitude)/2);
#if (temp_y < 0)
#declare tx = (-tx);
#end
#if (rand(R) < 0.5) // 50-50 chance of using the negative square root
#declare tx = (-tx);
#declare ty = (-ty);
#end
#declare tx = ((1-tx)/2);
#declare ty = (ty/2);
#declare tz = (P/2);
#if (mod(i,detail) = 0)
sphere {<tx,ty,tz>,0.0625,1 pigment {rgb vnormalize(<tx,ty,tz>)} finish {phong
1/(1+sqrt(tx*tx + ty*ty))}}
#end
#declare i = (i+1);
#end
#declare k = (k - 0.025);
#end
}
Post a reply to this message
|
|