MathGroup Archive 2009

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: eyeofra_ifs.gif (GIF Image, 1044x1044 pixels) - Scaled (87%)

  • To: mathgroup at smc.vnet.net
  • Subject: [mg101418] Re: [mg101388] eyeofra_ifs.gif (GIF Image, 1044x1044 pixels) - Scaled (87%)
  • From: John Fultz <jfultz at wolfram.com>
  • Date: Sun, 5 Jul 2009 23:17:42 -0400 (EDT)
  • Reply-to: jfultz at wolfram.com

On Sat, 4 Jul 2009 06:43:42 -0400 (EDT), Roger Bagula wrote:
> http://www.geocities.com/rlbagulatftn/eyeofra_ifs.gif
>
> The Eye of Ra fractal
> by doing an affine inside the
> kiss ellipse with reduced the number of transforms in
> Mathematica:
> Clear[f, dlst, pt, cr, ptlst, x, y]
> RandomSeed[];
> dlst = Table[ Random[Integer, {1, 2}], {n, 100000}];
> f[1, {x_, y_}] := N[ {2*x*y/(x^2 + y^2) , (y^2 - x^2)/(y^2 + x^2)}];
> f[2, {x_, y_}] := N[ {(2*((x - y)/
> Sqrt[2]) - (x + y)/Sqrt[2])/(
> 2.83), (2*((x - y)/Sqrt[2]) + (x + y)/Sqrt[2])/(2.83)}];
> pt = {0.5, 0.75};
> cr[n_] := If[n - 2 == 0, RGBColor[
> 0, 0, 1], If[n - 3 == 0, RGBColor[0,
> 1, 0], If[n - 1 == 0, RGBColor[1, 0, 0], RGBColor[0, 0, 0]]]]
> ptlst = Table[{cr[dlst[[j]]], Point[pt = f[dlst[[j]], Sequence[pt]]]},
> {j, Length[dlst]}];
> Show[Graphics[Join[{PointSize[.001]}, ptlst]],
> AspectRatio -> Automatic, PlotRange -> All]

New to version 7, when doing lists of multi-color points, it's much better to 
use a multi-Point primitive with the VertexColors option.  Here's an example of 
your code refactored (also used FoldList rather than your history-remembering 
global variable, which also adds a small speedup).  I think you'll find this
rendering significantly faster.

Clear[f, dlst, pt, cr, ptlst, x, y];
RandomSeed[];
dlst = Table[Random[Integer, {1, 2}], {n, 100000}];
f[{x_, y_}, 1] := N[{2*x*y/(x^2 + y^2), (y^2 - x^2)/(y^2 + x^2)}];
f[{x_, y_}, 2] := 
  N[{(2*((x - y)/Sqrt[2]) - (x + y)/
        Sqrt[2])/(2.83), (2*((x - y)/Sqrt[2]) + (x + y)/
        Sqrt[2])/(2.83)}];
cr[n_] := 
  If[n - 2 == 0, RGBColor[0, 0, 1], 
   If[n - 3 == 0, RGBColor[0, 1, 0], 
    If[n - 1 == 0, RGBColor[1, 0, 0], RGBColor[0, 0, 0]]]];
ptlst = {PointSize[.001], 
   Point[Rest[FoldList[f, {.5, .75}, dlst]], 
    VertexColors -> cr /@ dlst]};
Show[Graphics[Join[{PointSize[.001]}, ptlst]], 
 AspectRatio -> Automatic, PlotRange -> All]

Sincerely,
 
John Fultz
jfultz at wolfram.com
User Interface Group
Wolfram Research, Inc.




  • Prev by Date: Re: Re: Is Orange translucent? - What Methods exist?
  • Next by Date: Re: 3D plot with orthographic projection
  • Previous by thread: eyeofra_ifs.gif (GIF Image, 1044x1044 pixels) - Scaled (87%)
  • Next by thread: Re: eyeofra_ifs.gif (GIF Image, 1044x1044 pixels) - Scaled (87%)