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: [mg101433] Re: eyeofra_ifs.gif (GIF Image, 1044x1044 pixels) - Scaled (87%)
  • From: Yves Klett <yves.klett at googlemail.com>
  • Date: Tue, 7 Jul 2009 05:06:36 -0400 (EDT)
  • References: <h2rqcc$rsj$1@smc.vnet.net>

John,

VertexColors and Multi-Primitives certainly come in handy and offer new
effective approaches to complex visualization.

But... it is quite vexing that the old-fashioned code is rendered so
much slower (whatever the reasons).

Many users are not aware of the new approach for larger primitive sets,
and it is not very handy to have to re-write "old" code to get it to run
adequately fast. In my case, I often postprocess the "old" output into
multi-primitives (plus VertexColors) and then render them. But this is
not always trivial, and might put new users off (or have them complain
about bad performance, never a nice thing).

Since the rendering can be slowed down (or accelerated, depending on
where you stand) significantly, perhaps it would be nice if Mathematica
took care of that optimization internally and save the user the hassle.

Is there any intent at WRI to get over this issue (e.g. by transparently
preprocessing the output before rendering without changing the structure
of the graphics expression in the notebook) or will we have to get used
to this split approach and code accordingly?

Kind regards,
Yves



John Fultz schrieb:
> 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: Jens-Peer Kuska passed away
  • Next by Date: put some elements to zero
  • Previous by thread: Re: eyeofra_ifs.gif (GIF Image, 1044x1044 pixels) - Scaled (87%)
  • Next by thread: Parametric cylinder plots round in one instance and elliptical in