POV-Ray : Newsgroups : povray.newusers : is pi in any of the standard included fonts? (also, random character stream= : Re: is pi in any of the standard included fonts? (also, random character st= Server Time
29 Jul 2024 12:21:15 EDT (-0400)
  Re: is pi in any of the standard included fonts? (also, random character st=  
From: Smws
Date: 5 Dec 2005 10:15:01
Message: <web.439458629df7e1d46d4fb94b0@news.povray.org>
"Chris B" <c_b### [at] btconnectcomnospam> wrote:
> "Smws" <smw### [at] poboxcom> 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

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