POV-Ray : Newsgroups : povray.advanced-users : Can strings be used to create identifiers? : Re: Can strings be used to create identifiers? Server Time
26 Jun 2024 00:03:25 EDT (-0400)
  Re: Can strings be used to create identifiers?  
From: Thomas de Groot
Date: 25 Feb 2014 03:16:56
Message: <530c5178$1@news.povray.org>
On 25-2-2014 1:15, Kenneth wrote:
>> #macro color_vector_type()  rgb= #end
>> pigment{color_vector_type() <.3,.6,.9>}
>
> YES, that works; I tried it. (Actually just rgb, not rgb= ) That came as a
> surprise; I have never used a macro in quite this way. In fact, it gives me
> ideas on how to improve some of my old scenes.
>
> Very helpful, and very much appreciated!
>
> (IMO, something should be added to the documentation that describes this kind of
> macro use. The idea of using a macro to insert a KEYWORD is not obvious there,
> and it seems to be a rather powerful feature; it's the only way I know of at
> present to do such a thing, since using a string doesn't work. *Maybe* it could
> also be done by using a #read block, reading in a simple #written rgb, for
> example. Just a guess.)
>

Just out of curiosity, what would the advantage be of this trick? I 
assume that calling such a macro would increase parsing time, even if by 
only a tiny, tiny bit ;-)

Thomas


Post a reply to this message

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