|
![](/i/fill.gif) |
"Chris B" <c_b### [at] btconnect com nospam> wrote:
> "Smws" <smw### [at] pobox com> wrote in message
> news:web.4393b945d8624128b59af090@news.povray.org...
> > ... snip ...
> >
> > 2)In the same vein, is there an elegant way to get a random text stream?
> > I'm
> > filling a sphere with text and it would be nice to use this. I thought of
> > referencing an array with each character as an element, but that seems
> > tedious to construct (maybe I'm just really lazy).
> >
> > ... snip ...
> > Thanks!
> > Stefan Sittler
> >
>
> I think it's a little easier to assign the characters you want to use to a
> simple string variable and use the substr function to display one of them
> each time round your loop.
> For example:
>
>
> #declare CharacterSet =
>
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz%(){}&$'@!*=;:><.,?#~+_0123456789";
> #declare MySeed = seed(42);
>
> #local I = 0;
> #while (I<1000)
> text {
> ttf "arial.ttf",
> substr(CharacterSet,rand(MySeed)*strlen(CharacterSet),1),
> 0.2, 0
> pigment {rgb <rand(MySeed),rand(MySeed),rand(MySeed)>}
> translate <-0.25,-0.3,-0.1>
> rotate <rand(MySeed),rand(MySeed),rand(MySeed)>*360
> translate z*(1-pow(rand(MySeed),2))*4
> rotate <rand(MySeed),rand(MySeed),rand(MySeed)>*360
> }
> #local I = I + 1;
> #end
>
> camera {location <-1,1,-10> look_at <0,0,0>}
> light_source { <100, 1000, -2000> color rgb 1}
>
> Regards,
> Chris B.
Ah! Of course! Thank you very much.
-Stefan
Post a reply to this message
|
![](/i/fill.gif) |