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 stream= Server Time
29 Jul 2024 12:24:51 EDT (-0400)
  Re: is pi in any of the standard included fonts? (also, random character stream=  
From: Chris B
Date: 5 Dec 2005 07:25:28
Message: <439431b8$1@news.povray.org>
"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.


Post a reply to this message

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